Class TextOnlyComparator

  • All Implemented Interfaces:
    IRangeComparator

    public class TextOnlyComparator
    extends Object
    implements IRangeComparator
    A comparator that compares only the elements of text inside a given tag.
    • Constructor Detail

      • TextOnlyComparator

        public TextOnlyComparator​(TagNode tree)
    • Method Detail

      • getRangeCount

        public int getRangeCount()
        Description copied from interface: IRangeComparator
        Returns the number of comparable entities.
        Specified by:
        getRangeCount in interface IRangeComparator
        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 other IRangeComparator and index.
        Specified by:
        rangesEqual in interface IRangeComparator
        Parameters:
        owni - the index of the comparable entity within this IRangeComparator
        otherComp - the IRangeComparator to compare this with
        otheri - the index of the comparable entity within the other IRangeComparator
        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 interface IRangeComparator
        Parameters:
        arg0 - a number on which to base the decision whether to return true or false
        arg1 - another number on which to base the decision whether to return true or false
        arg2 - the other IRangeComparator to compare with
        Returns:
        true to avoid a too lengthy range comparison