Class NumeralSortString

  • All Implemented Interfaces:
    Comparable<NumeralSortString>

    public class NumeralSortString
    extends Object
    implements Comparable<NumeralSortString>
    Provides a sorting algorithm that splits groups of digits and sorts these segments as numbers, for example "sample-1, sample-2, sample-10" will be sorted in that order. String sorting would sort this "sample-1, sample-10, sample-2".
    • Constructor Detail

      • NumeralSortString

        public NumeralSortString​(String str)
        Creates a new NumeralSortString for the supplied string.
        Parameters:
        str - the string to apply numeral sorting on
    • Method Detail

      • getPart

        public org.daisy.braille.utils.pef.NumeralSortString.Part getPart​(int index)
        Gets the part of the string with the specified index.
        Parameters:
        index - index of the part to return
        Returns:
        returns the part
      • getPartCount

        public int getPartCount()
        Gets the number of parts.
        Returns:
        returns the number of parts
      • getValue

        public String getValue()
        Gets the value for this object.
        Returns:
        returns the value
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object