public class

Caverphone

extends Object
implements StringEncoder
java.lang.Object
   ↳ org.apache.commons.codec.language.Caverphone

Class Overview

Encodes a string into a Caverphone value. This is an algorithm created the Caversham Project at the University of Otago. It implements the Caverphone 2.0 algorithm:

Summary

Public Constructors
Caverphone()
Creates an instance of the Caverphone encoder
Public Methods
String caverphone(String txt)
Find the caverphone value of a String.
Object encode(Object pObject)
Encodes an Object using the caverphone algorithm.
String encode(String pString)
Encodes a String using the Caverphone algorithm.
boolean isCaverphoneEqual(String str1, String str2)
Tests if the caverphones of two strings are identical.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.commons.codec.Encoder
From interface org.apache.commons.codec.StringEncoder

Public Constructors

public Caverphone ()

Creates an instance of the Caverphone encoder

Public Methods

public String caverphone (String txt)

Find the caverphone value of a String.

Parameters
txt String to find the caverphone code for
Returns
  • A caverphone code corresponding to the String supplied

public Object encode (Object pObject)

Encodes an Object using the caverphone algorithm. This method is provided in order to satisfy the requirements of the Encoder interface, and will throw an EncoderException if the supplied object is not of type java.lang.String.

Parameters
pObject Object to encode
Returns
  • An object (or type java.lang.String) containing the caverphone code which corresponds to the String supplied.
Throws
EncoderException if the parameter supplied is not of type java.lang.String

public String encode (String pString)

Encodes a String using the Caverphone algorithm.

Parameters
pString String object to encode
Returns
  • The caverphone code corresponding to the String supplied

public boolean isCaverphoneEqual (String str1, String str2)

Tests if the caverphones of two strings are identical.

Parameters
str1 First of two strings to compare
str2 Second of two strings to compare
Returns
  • true if the caverphones of these strings are identical, false otherwise.