public abstract class DiffBase
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Change> |
changes |
protected int |
deletes |
protected java.lang.Object[] |
file0 |
protected java.lang.Object[] |
file1 |
protected int |
first0 |
protected int |
first1 |
protected UnaryPredicate |
ignore |
protected int |
inserts |
protected int |
last0 |
protected int |
last1 |
Modifier | Constructor and Description |
---|---|
protected |
DiffBase(java.lang.Object[] a,
java.lang.Object[] b) |
protected |
DiffBase(java.lang.String a,
java.lang.String b) |
Modifier and Type | Method and Description |
---|---|
protected void |
analyze_hunk(Diff.change hunk)
Look at a hunk of edit script and report the range of lines in each file that it applies to.
|
char |
change_letter(int inserts,
int deletes) |
java.util.List<Change> |
getChanges()
Return the list of Changes.
|
protected Diff.change |
hunkfun(Diff.change hunk)
Called with the tail of the script and returns the last link that belongs together with the start of the tail.
|
boolean |
isChanged()
Return true if there are changes between the two scripts.
|
protected void |
print_number_range(char sepchar,
int a,
int b)
Print a pair of line numbers with
sepchar , translated for file FILE. |
protected abstract Change |
printHunk(Diff.change hunk)
Print a Diff change hunk.
|
void |
printScript(Diff.change script)
Divide SCRIPT into pieces by calling
hunkfun(org.jeditor.diff.Diff.change) and print each piece with
printHunk(org.jeditor.diff.Diff.change) . |
protected UnaryPredicate ignore
protected java.lang.Object[] file0
protected java.lang.Object[] file1
protected int first0
protected int last0
protected int first1
protected int last1
protected int deletes
protected int inserts
protected java.util.List<Change> changes
protected DiffBase(java.lang.Object[] a, java.lang.Object[] b)
protected DiffBase(java.lang.String a, java.lang.String b)
public boolean isChanged()
public java.util.List<Change> getChanges()
public void printScript(Diff.change script)
hunkfun(org.jeditor.diff.Diff.change)
and print each piece with
printHunk(org.jeditor.diff.Diff.change)
.
Both functions take one arg, an edit script.
printHunk(org.jeditor.diff.Diff.change)
takes a subscript which belongs together (with a null link at the end) and prints it.script
- the change scriptprotected Diff.change hunkfun(Diff.change hunk)
hunk
- the hunkprotected void analyze_hunk(Diff.change hunk)
hunk
is the start of the hunk, which is a chain
of `struct change'. The first and last line numbers of file 0 are stored in *FIRST0 and *LAST0, and likewise for file 1 in *FIRST1 and *LAST1. Note that
these are internal line numbers that count from 0.
If no lines from file 0 are deleted, then FIRST0 is LAST0+1.
Also set *DELETES nonzero if any lines of file 0 are deleted and set *INSERTS nonzero if any lines of file 1 are inserted. If only ignorable lines are
inserted or deleted, both are set to 0.hunk
- the change hunkprotected abstract Change printHunk(Diff.change hunk)
hunk
- the change hunkprotected void print_number_range(char sepchar, int a, int b)
sepchar
, translated for file FILE. If the two numbers are identical, print just one number.
Args A and B are internal line numbers. We print the translated (real) line numbers.sepchar
- the separator charactera
- the first lineb
- the second linepublic char change_letter(int inserts, int deletes)
Copyright © 2016, 2017, 2018, 2019, 2023 Herve Girod. All Rights Reserved. Documentation and source under the MIT licence