Package org.outerj.daisy.diff.tag
Class TagComparator
- java.lang.Object
-
- org.outerj.daisy.diff.tag.TagComparator
-
- All Implemented Interfaces:
IRangeComparator
,IAtomSplitter
public class TagComparator extends Object implements IAtomSplitter
-
-
Constructor Summary
Constructors Constructor Description TagComparator(BufferedReader in)
TagComparator(String s)
TagComparator(StringBuilder s)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Atom
getAtom(int i)
List<Atom>
getAtoms()
int
getRangeCount()
Returns the number of comparable entities.boolean
rangesEqual(int thisIndex, IRangeComparator other, int otherIndex)
Returns whether the comparable entity given by the first index matches an entity specified by the otherIRangeComparator
and index.boolean
skipRangeComparison(int length, int maxLength, IRangeComparator other)
Returns whether a comparison should be skipped because it would be too costly (or lengthy).String
substring(int startAtom)
String
substring(int startAtom, int endAtom)
-
-
-
Constructor Detail
-
TagComparator
public TagComparator(String s)
-
TagComparator
public TagComparator(StringBuilder s)
-
TagComparator
public TagComparator(BufferedReader in) throws IOException
- Throws:
IOException
-
-
Method Detail
-
substring
public String substring(int startAtom, int endAtom)
- Specified by:
substring
in interfaceIAtomSplitter
-
substring
public String substring(int startAtom)
- Specified by:
substring
in interfaceIAtomSplitter
-
getAtom
public Atom getAtom(int i)
- Specified by:
getAtom
in interfaceIAtomSplitter
-
getRangeCount
public int getRangeCount()
Description copied from interface:IRangeComparator
Returns the number of comparable entities.- Specified by:
getRangeCount
in interfaceIRangeComparator
- Returns:
- the number of comparable entities
-
rangesEqual
public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex)
Description copied from interface:IRangeComparator
Returns whether the comparable entity given by the first index matches an entity specified by the otherIRangeComparator
and index.- Specified by:
rangesEqual
in interfaceIRangeComparator
- Parameters:
thisIndex
- the index of the comparable entity within thisIRangeComparator
other
- the IRangeComparator to compare this withotherIndex
- the index of the comparable entity within the otherIRangeComparator
- Returns:
true
if the comparable entities are equal
-
skipRangeComparison
public boolean skipRangeComparison(int length, int maxLength, IRangeComparator other)
Description copied from interface:IRangeComparator
Returns whether a comparison should be skipped because it would be too costly (or lengthy).- Specified by:
skipRangeComparison
in interfaceIRangeComparator
- Parameters:
length
- a number on which to base the decision whether to returntrue
orfalse
maxLength
- another number on which to base the decision whether to returntrue
orfalse
other
- the otherIRangeComparator
to compare with- Returns:
true
to avoid a too lengthy range comparison
-
-