public class DoubleMetaphone extends java.lang.Object implements StringEncoder
This class is conditionally thread-safe. The instance field for the maximum code length is mutable
setMaxCodeLen(int) but is not volatile, and accesses are not synchronized. If an instance of the class is
shared between threads, the caller needs to ensure that suitable synchronization is used to ensure safe publication
of the value between threads, and must not invoke setMaxCodeLen(int) after initial setup.
| Modifier and Type | Class and Description |
|---|---|
class |
DoubleMetaphone.DoubleMetaphoneResult
Stores results, since there is the optional alternate encoding.
|
| Constructor and Description |
|---|
DoubleMetaphone()
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
doubleMetaphone(java.lang.String value)
Encodes a value with Double Metaphone.
|
java.lang.String |
doubleMetaphone(java.lang.String value,
boolean alternate)
Encodes a value with Double Metaphone, optionally using the alternate encoding.
|
java.lang.Object |
encode(java.lang.Object obj)
Encodes the value using DoubleMetaphone.
|
java.lang.String |
encode(java.lang.String value)
Encodes the value using DoubleMetaphone.
|
int |
getMaxCodeLen()
Gets the maxCodeLen.
|
boolean |
isDoubleMetaphoneEqual(java.lang.String value1,
java.lang.String value2)
Tests whether the Double Metaphone values of two
String values
are equal. |
boolean |
isDoubleMetaphoneEqual(java.lang.String value1,
java.lang.String value2,
boolean alternate)
Tests whether the Double Metaphone values of two
String values
are equal, optionally using the alternate value. |
void |
setMaxCodeLen(int maxCodeLen)
Sets the maxCodeLen.
|
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 encode.alternate - use alternate encode.public java.lang.Object encode(java.lang.Object obj)
throws EncoderException
obj is a String (like Metaphone).encode in interface Encoderobj - Object to encode (should be of type String).EncoderException - encode parameter is not of type String.public java.lang.String encode(java.lang.String value)
encode in interface StringEncodervalue - String to encode.public int getMaxCodeLen()
public boolean isDoubleMetaphoneEqual(java.lang.String value1,
java.lang.String value2)
String values
are equal.value1 - The left-hand side of the encoded String.equals(Object).value2 - The right-hand side of the encoded String.equals(Object).true if the encoded Strings are equal;
false otherwise.isDoubleMetaphoneEqual(String,String,boolean)public boolean isDoubleMetaphoneEqual(java.lang.String value1,
java.lang.String value2,
boolean alternate)
String values
are equal, optionally using the alternate value.value1 - The left-hand side of the encoded String.equals(Object).value2 - The right-hand side of the encoded String.equals(Object).alternate - use the alternate value if true.true if the encoded Strings are equal;
false otherwise.public void setMaxCodeLen(int maxCodeLen)
maxCodeLen - The maxCodeLen to set.Copyright © 2010 - 2025 Adobe. All Rights Reserved