Skip to content
This repository was archived by the owner on Nov 12, 2019. It is now read-only.

Commit 74752a2

Browse files
committed
Fix JavaDoc and some IntelliJ code inspection results
1 parent 3450e48 commit 74752a2

16 files changed

+37
-53
lines changed

java-diff-utils-lib/src/main/java/difflib/ChangeDelta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/**
2121
* Describes the change-delta between original and revised texts.
22-
* @param T The type of the compared elements in the 'lines'.
22+
* @param <T> The type of the compared elements in the 'lines'.
2323
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
2424
*/
2525
public class ChangeDelta<T> extends Delta<T> {

java-diff-utils-lib/src/main/java/difflib/Chunk.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
*/
1616
package difflib;
1717

18-
import javax.annotation.Nonnegative;
1918
import java.util.Arrays;
2019
import java.util.List;
2120

21+
import javax.annotation.Nonnegative;
22+
2223
/**
2324
* Holds the information about the part of text involved in the diff process <p> Text is represented as
2425
* <code>Object[]</code> because the diff engine is capable of handling more than plain ascci. In fact, arrays or lists
2526
* of any type that implements {@link java.lang.Object#hashCode hashCode()} and {@link java.lang.Object#equals equals()}
2627
* correctly can be subject to differencing using this library. </p>
27-
* @param T The type of the compared elements in the 'lines'.
28+
* @param <T> The type of the compared elements in the 'lines'.
2829
* @author <a href="dm.naumenko@gmail.com>Dmitry Naumenko</a>
2930
*/
3031
public class Chunk<T> {
@@ -102,11 +103,6 @@ public int last() {
102103
return getPosition() + size() - 1;
103104
}
104105

105-
/*
106-
* (non-Javadoc)
107-
*
108-
* @see java.lang.Object#hashCode()
109-
*/
110106
@Override
111107
public int hashCode() {
112108
final int prime = 31;
@@ -117,11 +113,6 @@ public int hashCode() {
117113
return result;
118114
}
119115

120-
/*
121-
* (non-Javadoc)
122-
*
123-
* @see java.lang.Object#equals(java.lang.Object)
124-
*/
125116
@Override
126117
public boolean equals(Object obj) {
127118
if (this == obj)
@@ -136,9 +127,7 @@ public boolean equals(Object obj) {
136127
return false;
137128
} else if (!lines.equals(other.lines))
138129
return false;
139-
if (position != other.position)
140-
return false;
141-
return true;
130+
return position == other.position;
142131
}
143132

144133
@Override

java-diff-utils-lib/src/main/java/difflib/DeleteDelta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Describes the delete-delta between original and revised texts.
2222
*
2323
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
24-
* @param T The type of the compared elements in the 'lines'.
24+
* @param <T> The type of the compared elements in the 'lines'.
2525
*/
2626
public class DeleteDelta<T> extends Delta<T> {
2727

java-diff-utils-lib/src/main/java/difflib/Delta.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Describes the delta between original and revised texts.
2222
*
2323
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
24-
* @param T The type of the compared elements in the 'lines'.
24+
* @param <T> The type of the compared elements in the 'lines'.
2525
*/
2626
public abstract class Delta<T> {
2727

@@ -35,7 +35,7 @@ public abstract class Delta<T> {
3535
* Specifies the type of the delta.
3636
*
3737
*/
38-
public static enum TYPE {
38+
public enum TYPE {
3939
/** A change in the original. */
4040
CHANGE,
4141
/** A delete from the original. */
@@ -143,11 +143,10 @@ public boolean equals(Object obj) {
143143
} else if (!original.equals(other.original))
144144
return false;
145145
if (revised == null) {
146-
if (other.revised != null)
147-
return false;
148-
} else if (!revised.equals(other.revised))
149-
return false;
150-
return true;
146+
return other.revised == null;
147+
} else {
148+
return revised.equals(other.revised);
149+
}
151150
}
152151

153152
}

java-diff-utils-lib/src/main/java/difflib/DeltaComparator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/**
77
* @author mksenzov
8-
* @param T The type of the compared elements in the 'lines'.
8+
* @param <?> The type of the compared elements in the 'lines'.
99
*/
1010
public class DeltaComparator implements Comparator<Delta<?>>, Serializable {
1111
private static final long serialVersionUID = 1L;
@@ -24,4 +24,4 @@ public int compare(final Delta<?> a, final Delta<?> b) {
2424
}
2525
return 0;
2626
}
27-
}
27+
}

java-diff-utils-lib/src/main/java/difflib/DiffAlgorithm.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* The general interface for computing diffs between two lists of elements of type T.
2424
*
2525
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
26-
* @param T The type of the compared elements in the 'lines'.
26+
* @param <T> The type of the compared elements in the 'lines'.
2727
*/
2828
public interface DiffAlgorithm<T> {
2929

@@ -35,7 +35,7 @@ public interface DiffAlgorithm<T> {
3535
* @param revised The revised sequence. Must not be {@code null}.
3636
* @return The patch representing the diff of the given sequences. Never {@code null}.
3737
*/
38-
public Patch<T> diff(T[] original, T[] revised);
38+
Patch<T> diff(T[] original, T[] revised);
3939

4040
/**
4141
* Computes the difference between the original sequence and the revised
@@ -45,11 +45,11 @@ public interface DiffAlgorithm<T> {
4545
* @param revised The revised sequence. Must not be {@code null}.
4646
* @return The patch representing the diff of the given sequences. Never {@code null}.
4747
*/
48-
public Patch<T> diff(List<T> original, List<T> revised);
48+
Patch<T> diff(List<T> original, List<T> revised);
4949

5050
/**
5151
* Get equalizer use to compare data.
5252
* @return
5353
*/
54-
public Equalizer<T> getEqualizer();
54+
Equalizer<T> getEqualizer();
5555
}

java-diff-utils-lib/src/main/java/difflib/DiffRow.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public DiffRow(@Nonnull Tag tag, @Nullable String oldLine, @Nullable String newL
3636
this.newLine = newLine;
3737
}
3838

39-
public static enum Tag {
39+
public enum Tag {
4040
INSERT, DELETE, CHANGE, EQUAL, SKIP
4141
}
4242

@@ -125,11 +125,8 @@ public boolean equals(Object obj) {
125125
} else if (!oldLine.equals(other.oldLine))
126126
return false;
127127
if (tag == null) {
128-
if (other.tag != null)
129-
return false;
130-
} else if (!tag.equals(other.tag))
131-
return false;
132-
return true;
128+
return other.tag == null;
129+
} else return tag.equals(other.tag);
133130
}
134131

135132
public String toString() {

java-diff-utils-lib/src/main/java/difflib/DiffRowGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public List<DiffRow> generateDiffRows(List<String> original, List<String> revise
388388
return diffRows;
389389
}
390390

391-
private static final void addChangeDiffRow(Equalizer<String> equalizer, List<DiffRow> diffRows, String orgLine,
391+
private static void addChangeDiffRow(Equalizer<String> equalizer, List<DiffRow> diffRows, String orgLine,
392392
String revLine, String defaultString) {
393393
boolean skipOrg = equalizer.skip(orgLine);
394394
boolean skipRev = equalizer.skip(revLine);
@@ -472,7 +472,7 @@ private List<String> addMissingLines(final List<String> lines, final int targetS
472472
return tempList;
473473
}
474474

475-
private static final LinkedList<String> charArrayToStringList(char[] cs) {
475+
private static LinkedList<String> charArrayToStringList(char[] cs) {
476476
LinkedList<String> result = new LinkedList<String>();
477477
for (Character character : cs) {
478478
result.add(character.toString());
@@ -559,4 +559,4 @@ public static String wrapInTag(String line, String tag, String cssClass) {
559559

560560
return startTag + PATTERN_CRLF.matcher(line).replaceAll(joinTag) + endTag;
561561
}
562-
}
562+
}

java-diff-utils-lib/src/main/java/difflib/DiffUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@
2828

2929
/**
3030
* Implements the difference and patching engine
31-
* @param T The type of the compared elements in the 'lines'.
3231
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
3332
* @version 0.4.1
3433
*/
3534
public class DiffUtils {
3635

37-
private static Pattern unifiedDiffChunkRe = Pattern
36+
private static final Pattern unifiedDiffChunkRe = Pattern
3837
.compile("^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@$");
3938

4039
private List<String> readLines(@Nonnull File file) {

java-diff-utils-lib/src/main/java/difflib/InsertDelta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Describes the add-delta between original and revised texts.
2222
*
2323
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
24-
* @param T
24+
* @param <T>
2525
* The type of the compared elements in the 'lines'.
2626
*/
2727
public class InsertDelta<T> extends Delta<T> {

0 commit comments

Comments
 (0)