org.norther.tammi.acorn.util
Class AlphaNumericComparator
java.lang.Object
org.norther.tammi.acorn.util.AlphaNumericComparator
- All Implemented Interfaces:
- Serializable, Comparator
public class AlphaNumericComparator
- extends Object
- implements Comparator, Serializable
A string token comparator recognizing numbers.
- Author:
- Ilkka Priha
- See Also:
- Serialized Form
|
Method Summary |
int |
compare(Object object1,
Object object2)
|
protected int |
compare(String token1,
String token2)
Compares two string tokens with embedded numerical sequences in ascending
order. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AlphaNumericComparator
public AlphaNumericComparator()
- Constructs a new comparator.
AlphaNumericComparator
public AlphaNumericComparator(boolean casep)
- Constructs a new comparator with order.
- Parameters:
casep - true for case-sensitive.
compare
public int compare(Object object1,
Object object2)
- Specified by:
compare in interface Comparator
compare
protected int compare(String token1,
String token2)
- Compares two string tokens with embedded numerical sequences in ascending
order.
- Parameters:
token1 - the first token to be compared.token2 - the second token to be compared.
- Returns:
- -1, 0 or 1 based on comparison.
Copyright © 2004 The Norther Organization. All rights reserved.