org.outerj.daisy.diff
Class BlockComparator
java.lang.Object
org.outerj.daisy.diff.BlockComparator
- All Implemented Interfaces:
- org.eclipse.compare.rangedifferencer.IRangeComparator
public class BlockComparator
- extends java.lang.Object
- implements org.eclipse.compare.rangedifferencer.IRangeComparator
A Comparator for diffing corresponding changes resulting from a line-based diff.
For example, if a line-based diff says "these lines were replaced by those lines",
then this comparator can be used to compare the content in those lines.
This comparator has also a little bit of special treatment for HTML/XML tags,
ie it tries to treat tags as single entities to be compared.
Method Summary |
int |
getRangeCount()
|
boolean |
rangesEqual(int thisIndex,
org.eclipse.compare.rangedifferencer.IRangeComparator other,
int otherIndex)
|
boolean |
skipRangeComparison(int length,
int maxLength,
org.eclipse.compare.rangedifferencer.IRangeComparator other)
|
java.lang.String |
substring(int startToken)
|
java.lang.String |
substring(int startToken,
int endToken)
|
java.lang.String[] |
substringSplitted(int startToken)
|
java.lang.String[] |
substringSplitted(int startToken,
int endToken)
Returns the substring as an array of strings, each array entry
corresponding to one line. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BlockComparator
public BlockComparator(java.lang.StringBuffer text)
- Parameters:
text
- should contain the lines of text concatenated with a "\n" in between
them.
getRangeCount
public int getRangeCount()
- Specified by:
getRangeCount
in interface org.eclipse.compare.rangedifferencer.IRangeComparator
rangesEqual
public boolean rangesEqual(int thisIndex,
org.eclipse.compare.rangedifferencer.IRangeComparator other,
int otherIndex)
- Specified by:
rangesEqual
in interface org.eclipse.compare.rangedifferencer.IRangeComparator
skipRangeComparison
public boolean skipRangeComparison(int length,
int maxLength,
org.eclipse.compare.rangedifferencer.IRangeComparator other)
- Specified by:
skipRangeComparison
in interface org.eclipse.compare.rangedifferencer.IRangeComparator
substring
public java.lang.String substring(int startToken)
substring
public java.lang.String substring(int startToken,
int endToken)
substringSplitted
public java.lang.String[] substringSplitted(int startToken)
substringSplitted
public java.lang.String[] substringSplitted(int startToken,
int endToken)
- Returns the substring as an array of strings, each array entry
corresponding to one line. The newlines themselves are also
entries in the array.
Copyright © -2012 . All Rights Reserved.