Class IntCharSetComparator

java.lang.Object
jflex.core.unicode.IntCharSetComparator
All Implemented Interfaces:
Comparator<IntCharSet>

public class IntCharSetComparator extends Object implements Comparator<IntCharSet>
Comparator of IntCharSet .
  • Constructor Details

    • IntCharSetComparator

      public IntCharSetComparator()
  • Method Details

    • compare

      public int compare(IntCharSet left, IntCharSet right)
      Compares two IntCharSets.

      Assumption: the IntCharSets are disjoint, e.g. members of a partition.

      This method does not implement subset order, but instead compares the smallest elements of the two sets, with the empty set smaller than any other set. This is to make the order total for partitions as in CharClasses. It is unlikely to otherwise be a useful order, and it does probably not implement the contract for Comparable.compareTo(T) correctly if the sets have the same smallest element but are not equal.

      Specified by:
      compare in interface Comparator<IntCharSet>
      Returns:
      0 if the parameter is equal, -1 if its smallest element (if any) is larger than the smallest element of this set, and +1 if it is larger.