• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
DoubleMetaphone Class Reference

Encodes a string into a double metaphone value. More...

Inheritance diagram for DoubleMetaphone:
StringEncoder Encoder

Description

This Implementation is based on the algorithm by Lawrence Philips.

Author
Apache Software Foundation
Version
Id
DoubleMetaphone.java,v 1.24 2004/06/05 18:32:04 ggregory Exp

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Classes

class  DoubleMetaphoneResult
 Inner class for storing results, since there is the optional alternate encoding. More...
 

Public Member Functions

 DoubleMetaphone ()
 Creates an instance of this DoubleMetaphone encoder.
 
String doubleMetaphone (String value)
 Encode a value with Double Metaphone. More...
 
String doubleMetaphone (String value, boolean alternate)
 Encode a value with Double Metaphone, optionally using the alternate encoding. More...
 
Object encode (Object obj) throws EncoderException
 Encode the value using DoubleMetaphone. More...
 
String encode (String value)
 Encode the value using DoubleMetaphone. More...
 
boolean isDoubleMetaphoneEqual (String value1, String value2)
 Check if the Double Metaphone values of two String values are equal. More...
 
boolean isDoubleMetaphoneEqual (String value1, String value2, boolean alternate)
 Check if the Double Metaphone values of two String values are equal, optionally using the alternate value. More...
 
int getMaxCodeLen ()
 Returns the maxCodeLen. More...
 
void setMaxCodeLen (int maxCodeLen)
 Sets the maxCodeLen. More...
 

Protected Member Functions

char charAt (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.
 

Static Protected Member Functions

static boolean contains (String value, int start, int length, String[] criteria)
 Determines whether value contains any of the criteria starting at index start and matching up to length length
 

Protected Attributes

int maxCodeLen = 4
 Maximum length of an encoding, default is 4.
 

Member Function Documentation

◆ doubleMetaphone() [1/2]

String doubleMetaphone ( String  value)
Parameters
valueString to encode
Returns
an encoded string

◆ doubleMetaphone() [2/2]

String doubleMetaphone ( String  value,
boolean  alternate 
)
Parameters
valueString to encode
alternateuse alternate encode
Returns
an encoded string

◆ encode() [1/2]

Object encode ( Object  obj) throws EncoderException

It will only work if obj is a String (like Metaphone).

Parameters
objObject to encode (should be of type String)
Returns
An encoded Object (will be of type String)
Exceptions
EncoderExceptionencode parameter is not of type String

Implements Encoder.

◆ encode() [2/2]

String encode ( String  value)
Parameters
valueString to encode
Returns
An encoded String

Implements StringEncoder.

◆ isDoubleMetaphoneEqual() [1/2]

boolean isDoubleMetaphoneEqual ( String  value1,
String  value2 
)
Parameters
value1The left-hand side of the encoded String.
value2The right-hand side of the encoded String.
Returns
true if the encoded Strings are equal; false otherwise.
See also
isDoubleMetaphoneEqual(String,String,boolean)

◆ isDoubleMetaphoneEqual() [2/2]

boolean isDoubleMetaphoneEqual ( String  value1,
String  value2,
boolean  alternate 
)
Parameters
value1The left-hand side of the encoded String.
value2The right-hand side of the encoded String.
alternateuse the alternate value if true.
Returns
true if the encoded Strings are equal; false otherwise.

◆ getMaxCodeLen()

int getMaxCodeLen ( )
Returns
int

◆ setMaxCodeLen()

void setMaxCodeLen ( int  maxCodeLen)
Parameters
maxCodeLenThe maxCodeLen to set