Interface ElementComparator


  • public interface ElementComparator
    An index-based comparator for a TokenSequence. An ElementComparator always exists in the context of a TokenSequence; indexes refer to this sequence.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int EQUALS
      A value indicating the left value was equal to the right value
      static int GREATER_THAN
      A value indicating the left value was greater than the right value
      static int LESS_THAN
      A value indicating the left value was less than the right value
    • Field Detail

      • LESS_THAN

        static final int LESS_THAN
        A value indicating the left value was less than the right value
        See Also:
        Constant Field Values
      • EQUALS

        static final int EQUALS
        A value indicating the left value was equal to the right value
        See Also:
        Constant Field Values
      • GREATER_THAN

        static final int GREATER_THAN
        A value indicating the left value was greater than the right value
        See Also:
        Constant Field Values
    • Method Detail

      • compareElements

        int compareElements​(int lhsIndex,
                            int rhsIndex)
        Compares two sequence elements, specified by index.
        Parameters:
        lhsIndex - the index of the left hand element in the comparison
        rhsIndex - the index of the right hand element in the comparison
        Returns:
        0 if the values are equal, 1 if the left elements value is greater, -1 if the left elements value is lesser. A null value is greater than any other non-null; two null values compare as equal.