org.openstreetmap.josm.tools
Class AlphanumComparator
java.lang.Object
org.openstreetmap.josm.tools.AlphanumComparator
- All Implemented Interfaces:
- java.util.Comparator<java.lang.String>
public class AlphanumComparator
- extends java.lang.Object
- implements java.util.Comparator<java.lang.String>
The Alphanum Algorithm is an improved sorting algorithm for strings
containing numbers: Instead of sorting numbers in ASCII order like a standard
sort, this algorithm sorts numbers in numeric order.
The Alphanum Algorithm is discussed at http://www.DaveKoelle.com
This is an updated version with enhancements made by Daniel Migowski, Andre
Bogus, and David Koelle.
Method Summary |
int |
compare(java.lang.String s1,
java.lang.String s2)
|
private java.lang.String |
getChunk(java.lang.String s,
int slength,
int marker)
Length of string is passed in for improved efficiency (only need to
calculate it once) * |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
AlphanumComparator
public AlphanumComparator()
getChunk
private java.lang.String getChunk(java.lang.String s,
int slength,
int marker)
- Length of string is passed in for improved efficiency (only need to
calculate it once) *
compare
public int compare(java.lang.String s1,
java.lang.String s2)
- Specified by:
compare
in interface java.util.Comparator<java.lang.String>
JOSM