Package org.outerj.daisy.diff.tag
Class ArgumentComparator
- java.lang.Object
-
- org.outerj.daisy.diff.tag.ArgumentComparator
-
- All Implemented Interfaces:
IRangeComparator
,IAtomSplitter
public class ArgumentComparator extends Object implements IAtomSplitter
Takes a String and generates tokens/atoms that can be used by LCS. This comparator is used specifically for arguments inside HTML tags.
-
-
Constructor Summary
Constructors Constructor Description ArgumentComparator(String s)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Atom
getAtom(int i)
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
-
ArgumentComparator
public ArgumentComparator(String s)
-
-
Method Detail
-
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
-
substring
public String substring(int startAtom, int endAtom)
- Specified by:
substring
in interfaceIAtomSplitter
-
substring
public String substring(int startAtom)
- Specified by:
substring
in interfaceIAtomSplitter
-
-