Skip to content

Commit 90fcdee

Browse files
committed
reformated whole code base
1 parent 26a0601 commit 90fcdee

31 files changed

+939
-889
lines changed

src/main/java/difflib/ChangeDelta.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,25 @@
1919

2020
/**
2121
* Describes the change-delta between original and revised texts.
22-
*
22+
*
2323
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
2424
* @param T The type of the compared elements in the 'lines'.
2525
*/
2626
public class ChangeDelta<T> extends Delta<T> {
27-
27+
2828
/**
2929
* Creates a change delta with the two given chunks.
30+
*
3031
* @param original The original chunk. Must not be {@code null}.
3132
* @param revised The original chunk. Must not be {@code null}.
3233
*/
33-
public ChangeDelta(Chunk<T> original, Chunk<T>revised) {
34-
super(original, revised);
34+
public ChangeDelta(Chunk<T> original, Chunk<T> revised) {
35+
super(original, revised);
3536
}
36-
37+
3738
/**
3839
* {@inheritDoc}
39-
*
40+
*
4041
* @throws PatchFailedException
4142
*/
4243
@Override
@@ -53,7 +54,7 @@ public void applyTo(List<T> target) throws PatchFailedException {
5354
i++;
5455
}
5556
}
56-
57+
5758
/**
5859
* {@inheritDoc}
5960
*/
@@ -70,7 +71,7 @@ public void restore(List<T> target) {
7071
i++;
7172
}
7273
}
73-
74+
7475
/**
7576
* {@inheritDoc}
7677
*/
@@ -81,7 +82,7 @@ public void verify(List<T> target) throws PatchFailedException {
8182
+ "delta original position > target size");
8283
}
8384
}
84-
85+
8586
@Override
8687
public String toString() {
8788
return "[ChangeDelta, position: " + getOriginal().getPosition() + ", lines: "

src/main/java/difflib/Chunk.java

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,55 +20,48 @@
2020

2121
/**
2222
* Holds the information about the part of text involved in the diff process
23-
*
23+
*
2424
* <p>
25-
* Text is represented as <code>Object[]</code> because the diff engine is
26-
* capable of handling more than plain ascci. In fact, arrays or lists of any
27-
* type that implements {@link java.lang.Object#hashCode hashCode()} and
28-
* {@link java.lang.Object#equals equals()} correctly can be subject to
29-
* differencing using this library.
25+
* Text is represented as <code>Object[]</code> because the diff engine is capable of handling more
26+
* than plain ascci. In fact, arrays or lists of any type that implements
27+
* {@link java.lang.Object#hashCode hashCode()} and {@link java.lang.Object#equals equals()}
28+
* correctly can be subject to differencing using this library.
3029
* </p>
31-
*
30+
*
3231
* @author <a href="dm.naumenko@gmail.com>Dmitry Naumenko</a>
3332
* @param T The type of the compared elements in the 'lines'.
3433
*/
3534
public class Chunk<T> {
3635

3736
private final int position;
3837
private List<T> lines;
39-
38+
4039
/**
4140
* Creates a chunk and saves a copy of affected lines
42-
*
43-
* @param position
44-
* the start position
45-
* @param lines
46-
* the affected lines
41+
*
42+
* @param position the start position
43+
* @param lines the affected lines
4744
*/
4845
public Chunk(int position, List<T> lines) {
4946
this.position = position;
5047
this.lines = lines;
5148
}
52-
49+
5350
/**
5451
* Creates a chunk and saves a copy of affected lines
55-
*
56-
* @param position
57-
* the start position
58-
* @param lines
59-
* the affected lines
52+
*
53+
* @param position the start position
54+
* @param lines the affected lines
6055
*/
6156
public Chunk(int position, T[] lines) {
6257
this.position = position;
6358
this.lines = Arrays.asList(lines);
6459
}
65-
60+
6661
/**
67-
* Verifies that this chunk's saved text matches the corresponding text in
68-
* the given sequence.
69-
*
70-
* @param target
71-
* the sequence to verify against.
62+
* Verifies that this chunk's saved text matches the corresponding text in the given sequence.
63+
*
64+
* @param target the sequence to verify against.
7265
*/
7366
public void verify(List<T> target) throws PatchFailedException {
7467
if (last() > target.size()) {
@@ -81,7 +74,7 @@ public void verify(List<T> target) throws PatchFailedException {
8174
}
8275
}
8376
}
84-
77+
8578
/**
8679
* @return the start position of chunk in the text
8780
*/
@@ -103,14 +96,14 @@ public List<T> getLines() {
10396
public int size() {
10497
return lines.size();
10598
}
106-
99+
107100
/**
108101
* Returns the index of the last line of the chunk.
109102
*/
110103
public int last() {
111104
return getPosition() + size() - 1;
112105
}
113-
106+
114107
/*
115108
* (non-Javadoc)
116109
*
@@ -125,34 +118,40 @@ public int hashCode() {
125118
result = prime * result + size();
126119
return result;
127120
}
128-
121+
129122
/*
130123
* (non-Javadoc)
131124
*
132125
* @see java.lang.Object#equals(java.lang.Object)
133126
*/
134127
@Override
135128
public boolean equals(Object obj) {
136-
if (this == obj)
129+
if (this == obj) {
137130
return true;
138-
if (obj == null)
131+
}
132+
if (obj == null) {
139133
return false;
140-
if (getClass() != obj.getClass())
134+
}
135+
if (getClass() != obj.getClass()) {
141136
return false;
137+
}
142138
Chunk<T> other = (Chunk) obj;
143139
if (lines == null) {
144-
if (other.lines != null)
140+
if (other.lines != null) {
145141
return false;
146-
} else if (!lines.equals(other.lines))
142+
}
143+
} else if (!lines.equals(other.lines)) {
147144
return false;
148-
if (position != other.position)
145+
}
146+
if (position != other.position) {
149147
return false;
148+
}
150149
return true;
151150
}
152-
151+
153152
@Override
154153
public String toString() {
155154
return "[position: " + position + ", size: " + size() + ", lines: " + lines + "]";
156155
}
157-
156+
158157
}

src/main/java/difflib/DeleteDelta.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,25 @@
1919

2020
/**
2121
* Describes the delete-delta between original and revised texts.
22-
*
22+
*
2323
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
2424
* @param T The type of the compared elements in the 'lines'.
2525
*/
2626
public class DeleteDelta<T> extends Delta<T> {
27-
28-
/**
29-
* Creates a change delta with the two given chunks.
30-
*
31-
* @param original
32-
* The original chunk. Must not be {@code null}.
33-
* @param revised
34-
* The original chunk. Must not be {@code null}.
35-
*/
27+
28+
/**
29+
* Creates a change delta with the two given chunks.
30+
*
31+
* @param original The original chunk. Must not be {@code null}.
32+
* @param revised The original chunk. Must not be {@code null}.
33+
*/
3634
public DeleteDelta(Chunk<T> original, Chunk<T> revised) {
3735
super(original, revised);
3836
}
39-
37+
4038
/**
4139
* {@inheritDoc}
42-
*
40+
*
4341
* @throws PatchFailedException
4442
*/
4543
@Override
@@ -51,7 +49,7 @@ public void applyTo(List<T> target) throws PatchFailedException {
5149
target.remove(position);
5250
}
5351
}
54-
52+
5553
/**
5654
* {@inheritDoc}
5755
*/
@@ -63,17 +61,17 @@ public void restore(List<T> target) {
6361
target.add(position + i, lines.get(i));
6462
}
6563
}
66-
64+
6765
@Override
6866
public TYPE getType() {
6967
return Delta.TYPE.DELETE;
7068
}
71-
69+
7270
@Override
7371
public void verify(List<T> target) throws PatchFailedException {
7472
getOriginal().verify(target);
7573
}
76-
74+
7775
@Override
7876
public String toString() {
7977
return "[DeleteDelta, position: " + getOriginal().getPosition() + ", lines: "

0 commit comments

Comments
 (0)