Package org.daisy.braille.pef
Class NumeralSortString
- java.lang.Object
-
- org.daisy.braille.pef.NumeralSortString
-
- All Implemented Interfaces:
java.lang.Comparable<NumeralSortString>
public class NumeralSortString extends java.lang.Object implements java.lang.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".- Author:
- Joel HÃ¥kansson
-
-
Constructor Summary
Constructors Constructor Description NumeralSortString(java.lang.String str)
Creates a new NumeralSortString for the supplied string
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(NumeralSortString otherObj)
boolean
equals(java.lang.Object obj)
org.daisy.braille.pef.NumeralSortString.Part
getPart(int index)
Gets the part of the string with the specified index.int
getPartCount()
Gets the number of partsjava.lang.String
getValue()
Gets the value for this object.int
hashCode()
-
-
-
Method Detail
-
getPart
public org.daisy.braille.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 java.lang.String getValue()
Gets the value for this object.- Returns:
- returns the value
-
compareTo
public int compareTo(NumeralSortString otherObj)
- Specified by:
compareTo
in interfacejava.lang.Comparable<NumeralSortString>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-