| java.lang.Object org.apache.commons.codec.StringEncoderComparator
StringEncoderComparator | public class StringEncoderComparator implements Comparator(Code) | | Strings are comparable, and this comparator allows
you to configure it with an instance of a class
which implements StringEncoder. This comparator
is used to sort Strings by an encoding scheme such
as Soundex, Metaphone, etc. This class can come in
handy if one need to sort Strings by an encoded
form of a name such as Soundex.
author: Apache Software Foundation version: $Id: StringEncoderComparator.java,v 1.14 2004/06/21 23:24:17 ggregory Exp $ |
Method Summary | |
public int | compare(Object o1, Object o2) Compares two strings based not on the strings
themselves, but on an encoding of the two
strings using the StringEncoder this Comparator
was created with. |
StringEncoderComparator | public StringEncoderComparator()(Code) | | Constructs a new instance.
|
StringEncoderComparator | public StringEncoderComparator(StringEncoder stringEncoder)(Code) | | Constructs a new instance with the given algorithm.
Parameters: stringEncoder - the StringEncoder used for comparisons. |
compare | public int compare(Object o1, Object o2)(Code) | | Compares two strings based not on the strings
themselves, but on an encoding of the two
strings using the StringEncoder this Comparator
was created with.
If an
EncoderException is encountered, return 0 .
Parameters: o1 - the object to compare Parameters: o2 - the object to compare to the Comparable.compareTo() return code or 0 if an encoding error was caught. See Also: Comparable |
|
|