Class AncestorComparator
- java.lang.Object
-
- org.outerj.daisy.diff.html.ancestor.AncestorComparator
-
- All Implemented Interfaces:
IRangeComparator
public class AncestorComparator extends Object implements IRangeComparator
A comparator used when calculating the difference in ancestry of two Nodes.
-
-
Constructor Summary
Constructors Constructor Description AncestorComparator(List<TagNode> ancestors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TagNode
getAncestor(int i)
String
getCompareTxt()
int
getRangeCount()
Returns the number of comparable entities.AncestorComparatorResult
getResult(AncestorComparator other, Locale locale)
boolean
rangesEqual(int owni, IRangeComparator otherComp, int otheri)
Returns whether the comparable entity given by the first index matches an entity specified by the otherIRangeComparator
and index.boolean
skipRangeComparison(int arg0, int arg1, IRangeComparator arg2)
Returns whether a comparison should be skipped because it would be too costly (or lengthy).
-
-
-
Method Detail
-
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 owni, IRangeComparator otherComp, int otheri)
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:
owni
- the index of the comparable entity within thisIRangeComparator
otherComp
- the IRangeComparator to compare this withotheri
- the index of the comparable entity within the otherIRangeComparator
- Returns:
true
if the comparable entities are equal
-
skipRangeComparison
public boolean skipRangeComparison(int arg0, int arg1, IRangeComparator arg2)
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:
arg0
- a number on which to base the decision whether to returntrue
orfalse
arg1
- another number on which to base the decision whether to returntrue
orfalse
arg2
- the otherIRangeComparator
to compare with- Returns:
true
to avoid a too lengthy range comparison
-
getAncestor
public TagNode getAncestor(int i)
-
getCompareTxt
public String getCompareTxt()
-
getResult
public AncestorComparatorResult getResult(AncestorComparator other, Locale locale)
-
-