public class Trace
extends java.lang.Object
Constructor and Description |
---|
Trace(int oldSize,
int newSize) |
Modifier and Type | Method and Description |
---|---|
int |
bestPossible() |
java.util.List<Hunk> |
createHunks(java.lang.String[] oldFile,
java.lang.String[] newFile)
Since the diff was performed backwards, "popping" the resulting edits from
the backwards tree gives them in forward order.
|
int |
getMatches() |
boolean |
isDone() |
Trace |
next() |
void |
setNext(Trace nextIn) |
boolean |
step(java.lang.String[] oldFile,
java.lang.String[] newFile)
Step once in this trace.
|
public Trace(int oldSize, int newSize)
oldSize
- The size of the old file.newSize
- The size of the new file.public Trace next()
public void setNext(Trace nextIn)
nextIn
- The next trace in the linked list.public int getMatches()
public boolean isDone()
public int bestPossible()
public boolean step(java.lang.String[] oldFile, java.lang.String[] newFile)
This step method steps backward through the files. This is for the simple reason that when creating hunks, we want to create them in forward order, but we have to visit the edits backwards from how we diffed them. Two backwards make a forward, two negatives make a positive, and two wrongs make a right.
oldFile
- The old(first, from) filenewFile
- The new(second, to) filepublic java.util.List<Hunk> createHunks(java.lang.String[] oldFile, java.lang.String[] newFile)
oldFile
- The old(first, from) filenewFile
- The new(second, to) file