Class CollatingComparator<T>

    • Field Detail

      • order

        protected int order
        The sort order flag.
    • Constructor Detail

      • CollatingComparator

        public CollatingComparator​(int order,
                                   Locale locale,
                                   int strength)
        This constructor initializes a localized Collator and the sort order.
        Parameters:
        order - The wished sort order.
        locale - The Locale to use.
        strength - The comparison strength to use in the collator.
    • Method Detail

      • revert

        public void revert()
        This method reverts the sort order.
      • asc

        public void asc()
        This method sets to ascending sort order.
      • compareLocale

        protected abstract int compareLocale​(T o1,
                                             T o2)
        This abstract method provides a compare method in a locale way which is provided by the derived class. This method should not respect the sort order flag as it is ment to provide alnoy a native Locale comparison method. You can implement cascaded comparisons like surename, forename, etc.
        Parameters:
        o1 - The first object to compare.
        o2 - The second object to compare.
        Returns:
        An integer which is zero on equal words, a negative integer if v1 is smaller than v2 and a positive number if v1 is greater than v2.