Skip to content

Commit fbb51d2

Browse files
committed
1 parent 5781cc5 commit fbb51d2

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

java-diff-utils/src/main/java/com/github/difflib/patch/AbstractDelta.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ protected void verifyChunk(List<T> target) throws PatchFailedException {
6060
public abstract void applyTo(List<T> target) throws PatchFailedException;
6161

6262
public abstract void restore(List<T> target);
63+
64+
public abstract AbstractDelta<T> withChunks(Chunk<T> original, Chunk<T> revised);
6365

6466
@Override
6567
public int hashCode() {

java-diff-utils/src/main/java/com/github/difflib/patch/ChangeDelta.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,9 @@ public String toString() {
7272
return "[ChangeDelta, position: " + getSource().getPosition() + ", lines: "
7373
+ getSource().getLines() + " to " + getTarget().getLines() + "]";
7474
}
75+
76+
@Override
77+
public AbstractDelta<T> withChunks(Chunk<T> original, Chunk<T> revised) {
78+
return new ChangeDelta(original, revised);
79+
}
7580
}

java-diff-utils/src/main/java/com/github/difflib/patch/DeleteDelta.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,9 @@ public String toString() {
5959
return "[DeleteDelta, position: " + getSource().getPosition() + ", lines: "
6060
+ getSource().getLines() + "]";
6161
}
62+
63+
@Override
64+
public AbstractDelta<T> withChunks(Chunk<T> original, Chunk<T> revised) {
65+
return new DeleteDelta(original, revised);
66+
}
6267
}

java-diff-utils/src/main/java/com/github/difflib/patch/EqualDelta.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ public String toString() {
4141
return "[EqualDelta, position: " + getSource().getPosition() + ", lines: "
4242
+ getSource().getLines() + "]";
4343
}
44+
45+
@Override
46+
public AbstractDelta<T> withChunks(Chunk<T> original, Chunk<T> revised) {
47+
return new EqualDelta(original, revised);
48+
}
4449
}

java-diff-utils/src/main/java/com/github/difflib/patch/InsertDelta.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,9 @@ public String toString() {
5959
return "[InsertDelta, position: " + getSource().getPosition()
6060
+ ", lines: " + getTarget().getLines() + "]";
6161
}
62+
63+
@Override
64+
public AbstractDelta<T> withChunks(Chunk<T> original, Chunk<T> revised) {
65+
return new InsertDelta(original, revised);
66+
}
6267
}

0 commit comments

Comments
 (0)