public class RefinedSoundex extends Object implements StringEncoder
This class is immutable and thread-safe.
Modifier and Type | Field and Description |
---|---|
static RefinedSoundex |
US_ENGLISH
This static variable contains an instance of the RefinedSoundex using
the US_ENGLISH mapping.
|
static String |
US_ENGLISH_MAPPING_STRING
Mapping:
|
Constructor and Description |
---|
RefinedSoundex()
Creates an instance of the RefinedSoundex object using the default US
English mapping.
|
RefinedSoundex(char[] mapping)
Creates a refined soundex instance using a custom mapping.
|
RefinedSoundex(String mapping)
Creates a refined Soundex instance using a custom mapping.
|
Modifier and Type | Method and Description |
---|---|
int |
difference(String s1,
String s2)
Returns the number of characters in the two encoded Strings that are the
same.
|
Object |
encode(Object obj)
Encodes an Object using the refined soundex algorithm.
|
String |
encode(String str)
Encodes a String using the refined soundex algorithm.
|
String |
soundex(String str)
Retrieves the Refined Soundex code for a given String object.
|
public static final RefinedSoundex US_ENGLISH
public static final String US_ENGLISH_MAPPING_STRING
0: A E I O U Y H W 1: B P 2: F V 3: C K S 4: G J 5: Q X Z 6: D T 7: L 8: M N 9: R
public RefinedSoundex()
public RefinedSoundex(char[] mapping)
mapping
- Mapping array to use when finding the corresponding code for
a given characterpublic RefinedSoundex(String mapping)
mapping
- Mapping string to use when finding the corresponding code for a given characterpublic int difference(String s1, String s2) throws EncoderException
s1
- A String that will be encoded and compared.s2
- A String that will be encoded and compared.EncoderException
- if an error occurs encoding one of the stringsSoundexUtils.difference(StringEncoder,String,String)
,
MS T-SQL DIFFERENCEpublic Object encode(Object obj) throws EncoderException
encode
in interface Encoder
obj
- Object to encodeEncoderException
- if the parameter supplied is not of type java.lang.Stringpublic String encode(String str)
encode
in interface StringEncoder
str
- A String object to encode