com.sun.mdm.index.phonetic.impl
Class Soundex

java.lang.Object
  extended bycom.sun.mdm.index.phonetic.impl.Soundex
All Implemented Interfaces:
PhoneticEncoder

public class Soundex
extends java.lang.Object
implements PhoneticEncoder

Encode a string using the Soundex algorithm.


Field Summary
static java.lang.String ENCODING_TYPE
          Informative String about the encoding type this encoder does
static char[] US_ENGLISH_MAPPING
          The default soundex mapping used
 
Constructor Summary
Soundex()
          Creates a new Soundex encoder
Soundex(char[] mapping)
          Creates a new Soundex encoder using a given soundex mapping
 
Method Summary
 java.lang.String encode(java.lang.String value)
          Encode the value using Soundex.
 java.lang.String encode(java.lang.String str, java.lang.String domain)
          Encode a string phoneticaly with SoundEx.
 java.lang.String getEncodingType()
          Getter for the encoding type attribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING_TYPE

public static final java.lang.String ENCODING_TYPE
Informative String about the encoding type this encoder does

See Also:
Constant Field Values

US_ENGLISH_MAPPING

public static final char[] US_ENGLISH_MAPPING
The default soundex mapping used

Constructor Detail

Soundex

public Soundex()
Creates a new Soundex encoder


Soundex

public Soundex(char[] mapping)
Creates a new Soundex encoder using a given soundex mapping

Parameters:
mapping - the soundex mapping to use
Method Detail

encode

public java.lang.String encode(java.lang.String value)
                        throws PhoneticEncoderException
Encode the value using Soundex.

Specified by:
encode in interface PhoneticEncoder
Parameters:
value - String to encode
Returns:
An encoded String
Throws:
PhoneticEncoderException - thrown if there is an exception during the encoding process.

encode

public java.lang.String encode(java.lang.String str,
                               java.lang.String domain)
                        throws PhoneticEncoderException
Encode a string phoneticaly with SoundEx. This algorithm is sampled from the code-snippers on http://www.sourceforge.net/

Specified by:
encode in interface PhoneticEncoder
Parameters:
str - The string to encode
domain - A domain marking the country/language context. An optional feature for an encoder to implement. This encoder does not currently support domains.
Returns:
the encoded version of the strToEncode
Throws:
PhoneticEncoderException - if the encoding fails.

getEncodingType

public java.lang.String getEncodingType()
Getter for the encoding type attribute

Specified by:
getEncodingType in interface PhoneticEncoder
Returns:
the encoding type the Phonetic Encoder implements (such as NYSIIS or Soundex) This value is for information purposes and is not enforced to be of the same value as the 'encoding type' listed in the PhoneticEncodersConfiguration for the encoder class instance. As a result it should not be used for calls to the Phoneticizer.


Sun Microsystems, Inc.