public class RefinedSoundex extends java.lang.Object implements StringEncoder
| Modifier and Type | Field and Description |
|---|---|
private char[] |
soundexMapping
Every letter of the alphabet is "mapped" to a numerical value.
|
static RefinedSoundex |
US_ENGLISH
This static variable contains an instance of the RefinedSoundex using
the US_ENGLISH mapping.
|
static char[] |
US_ENGLISH_MAPPING
RefinedSoundex is *refined* for a number of reasons one being that the
mappings have been altered.
|
static java.lang.String |
US_ENGLISH_MAPPING_STRING |
| 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(java.lang.String mapping)
Creates a refined Soundex instance using a custom mapping.
|
| Modifier and Type | Method and Description |
|---|---|
int |
difference(java.lang.String s1,
java.lang.String s2)
Returns the number of characters in the two encoded Strings that are the
same.
|
java.lang.Object |
encode(java.lang.Object pObject)
Encodes an Object using the refined soundex algorithm.
|
java.lang.String |
encode(java.lang.String pString)
Encodes a String using the refined soundex algorithm.
|
(package private) char |
getMappingCode(char c)
Returns the mapping code for a given character.
|
java.lang.String |
soundex(java.lang.String str)
Retreives the Refined Soundex code for a given String object.
|
public static final java.lang.String US_ENGLISH_MAPPING_STRING
public static final char[] US_ENGLISH_MAPPING
private final char[] soundexMapping
public static final RefinedSoundex US_ENGLISH
public RefinedSoundex()
public RefinedSoundex(char[] mapping)
mapping - Mapping array to use when finding the corresponding code for
a given characterpublic RefinedSoundex(java.lang.String mapping)
mapping - Mapping string to use when finding the corresponding code for a given characterpublic int difference(java.lang.String s1,
java.lang.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 java.lang.Object encode(java.lang.Object pObject)
throws EncoderException
encode in interface EncoderpObject - Object to encodeEncoderException - if the parameter supplied is not of type java.lang.Stringpublic java.lang.String encode(java.lang.String pString)
encode in interface StringEncoderpString - A String object to encodechar getMappingCode(char c)
c - char to get mapping forpublic java.lang.String soundex(java.lang.String str)
str - String to encode using the Refined Soundex algorithmcommons-codec version 1.4 - Copyright © 2002-2018 - Apache Software Foundation