Package org.webcat.diff
Class Diff<T>
- java.lang.Object
-
- org.webcat.diff.Diff<T>
-
- Type Parameters:
T
- the type of object represented by the diff
public class Diff<T> extends Object
Class representing one diff operation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Diff.Operation
The data structure representing a diff is a Linked list of Diff objects: {Diff(Operation.DELETE, "Hello"), Diff(Operation.INSERT, "Goodbye"), Diff(Operation.EQUAL, " world.")} which means: delete "Hello", add "Goodbye" and keep " world."
-
Field Summary
Fields Modifier and Type Field Description List<T>
list
The text associated with this diff operation.Diff.Operation
operation
One of: INSERT, DELETE or EQUAL.
-
Constructor Summary
Constructors Constructor Description Diff(Diff.Operation operation, List<T> list)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object d)
Is this Diff equivalent to another Diff?String
toString()
Display a human-readable version of this Diff.
-
-
-
Field Detail
-
operation
public Diff.Operation operation
One of: INSERT, DELETE or EQUAL.
-
-
Constructor Detail
-
Diff
public Diff(Diff.Operation operation, List<T> list)
Constructor. Initializes the diff with the provided values.- Parameters:
operation
- One of INSERT, DELETE or EQUAL.list
- The text being applied.
-
-
Method Detail
-
toString
public String toString()
Display a human-readable version of this Diff.
-
-