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

Commit 74f025e

Browse files
add type information to the interface
git-svn-id: http://java-diff-utils.googlecode.com/svn/trunk@25 d8d7d024-a22d-11de-b755-fd640f38fa9d
1 parent f74a584 commit 74f025e

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

src/difflib/ChangeDelta.java

+5
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,9 @@ public String toString() {
8484
return "[ChangeDelta, position: " + getOriginal().getPosition() + ", lines: "
8585
+ getOriginal().getLines() + " to " + getRevised().getLines() + "]";
8686
}
87+
88+
@Override
89+
public TYPE getType() {
90+
return Delta.TYPE.CHANGE;
91+
}
8792
}

src/difflib/DeleteDelta.java

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public void restore(List<Object> target) {
5858
}
5959
}
6060

61+
@Override
62+
public TYPE getType() {
63+
return Delta.TYPE.DELETE;
64+
}
65+
6166
@Override
6267
public void verify(List<?> target) throws PatchFailedException {
6368
getOriginal().verify(target);

src/difflib/Delta.java

+10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public abstract class Delta {
2626
private Chunk original;
2727
private Chunk revised;
2828

29+
public enum TYPE {
30+
CHANGE, DELETE, INSERT
31+
}
32+
2933
/**
3034
* Construct the delta for original and revised chunks
3135
*
@@ -61,6 +65,12 @@ public Delta(Chunk original, Chunk revised) {
6165
*/
6266
public abstract void restore(List<Object> target);
6367

68+
/**
69+
* Returns the type of delta
70+
* @return the type enum
71+
*/
72+
public abstract TYPE getType();
73+
6474
/**
6575
* @return the Chunk describing the original text
6676
*/

src/difflib/InsertDelta.java

+4
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public void verify(List<?> target) throws PatchFailedException {
6666

6767
}
6868

69+
public TYPE getType() {
70+
return Delta.TYPE.INSERT;
71+
}
72+
6973
@Override
7074
public String toString() {
7175
return "[InsertDelta, position: " + getOriginal().getPosition() + ", lines: "

0 commit comments

Comments
 (0)