|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.mdm.index.phonetic.impl.DoubleMetaphone
Encodes a string into a double metaphone value. This Implementation is based on the algorithm by Lawrence Philips.
Nested Class Summary | |
class |
DoubleMetaphone.DoubleMetaphoneResult
Inner class for storing results, since there is the optional alternate encoding. |
Field Summary | |
static java.lang.String |
ENCODING_TYPE
informative String about the encoding type this encoder does |
protected int |
maxCodeLen
Maximum length of an encoding, default is 4 |
Constructor Summary | |
DoubleMetaphone()
Creates an instance of this DoubleMetaphone encoder |
Method Summary | |
protected char |
charAt(java.lang.String value,
int index)
Gets the character at index index if available, otherwise it
returns Character.MIN_VALUE so that there is some sort of a
default |
protected static boolean |
contains(java.lang.String value,
int start,
int length,
java.lang.String[] criteria)
Determines whether value contains any of the criteria
starting
at index start and matching up to length length |
java.lang.String |
doubleMetaphone(java.lang.String value)
Encode a value with Double Metaphone |
java.lang.String |
doubleMetaphone(java.lang.String value,
boolean alternate)
Encode a value with Double Metaphone, optionally using the alternate encoding. |
java.lang.Object |
encode(java.lang.Object obj)
Encode the value using DoubleMetaphone. |
java.lang.String |
encode(java.lang.String value)
Encode the value using DoubleMetaphone. |
java.lang.String |
encode(java.lang.String value,
java.lang.String domain)
Encode the value using DoubleMetaphone. |
java.lang.String |
getEncodingType()
|
int |
getMaxCodeLen()
Returns the maxCodeLen. |
boolean |
isDoubleMetaphoneEqual(java.lang.String value1,
java.lang.String value2)
Check if the Double Metaphone values of two String values
are equal |
boolean |
isDoubleMetaphoneEqual(java.lang.String value1,
java.lang.String value2,
boolean alternate)
Check if the Double Metaphone values of two String values
are equal, optionally using the alternate value |
void |
setMaxCodeLen(int maxCodeLen)
Sets the maxCodeLen. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String ENCODING_TYPE
protected int maxCodeLen
Constructor Detail |
public DoubleMetaphone()
Method Detail |
protected char charAt(java.lang.String value, int index)
index
if available, otherwise it
returns Character.MIN_VALUE
so that there is some sort of a
default
protected static boolean contains(java.lang.String value, int start, int length, java.lang.String[] criteria)
value
contains any of the criteria
starting
at index start
and matching up to length length
public java.lang.String doubleMetaphone(java.lang.String value)
value
- String to encode
public java.lang.String doubleMetaphone(java.lang.String value, boolean alternate)
value
- String to encodealternate
- use alternate encode
public java.lang.Object encode(java.lang.Object obj) throws PhoneticEncoderException
obj
is a String
(like Metaphone
).
obj
- Object to encode (should be of type String)
PhoneticEncoderException
public java.lang.String encode(java.lang.String value)
encode
in interface PhoneticEncoder
value
- String to encode
PhoneticEncoderException
- thrown if there is an exception during
the encoding process.public java.lang.String encode(java.lang.String value, java.lang.String domain)
encode
in interface PhoneticEncoder
value
- String to encodedomain
- locality
PhoneticEncoderException
- thrown if there is an exception during
the encoding process.public java.lang.String getEncodingType()
PhoneticEncoder
getEncodingType
in interface PhoneticEncoder
public int getMaxCodeLen()
public boolean isDoubleMetaphoneEqual(java.lang.String value1, java.lang.String value2)
String
values
are equal
public boolean isDoubleMetaphoneEqual(java.lang.String value1, java.lang.String value2, boolean alternate)
String
values
are equal, optionally using the alternate value
public void setMaxCodeLen(int maxCodeLen)
maxCodeLen
- The maxCodeLen to set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Sun Microsystems, Inc.