net.sf.saxon.sort
Class AlphanumericComparer

java.lang.Object
  extended bynet.sf.saxon.sort.AlphanumericComparer
All Implemented Interfaces:
java.util.Comparator, java.io.Serializable

public class AlphanumericComparer
extends java.lang.Object
implements java.util.Comparator, java.io.Serializable

A Comparer that treats strings as an alternating sequence of alpha parts and numeric parts. The alpha parts are compared using a base collation supplied as a parameter; the numeric parts are compared numerically. "Numeric" here means a sequence of consecutive ASCII digits 0-9.

Note: this Comparator produces an ordering that is not compatible with equals().

See Also:
Serialized Form

Constructor Summary
AlphanumericComparer(java.util.Comparator base)
           
 
Method Summary
 int compare(java.lang.Object a1, java.lang.Object a2)
          Compare two objects.
 
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
 

Constructor Detail

AlphanumericComparer

public AlphanumericComparer(java.util.Comparator base)
Method Detail

compare

public int compare(java.lang.Object a1,
                   java.lang.Object a2)
Compare two objects.

Specified by:
compare in interface java.util.Comparator
Returns:
<0 if a0 if a>b