Class AbstractCaverphone
java.lang.Object
org.apache.commons.codec.language.AbstractCaverphone
- All Implemented Interfaces:
Encoder
,StringEncoder
- Direct Known Subclasses:
Caverphone1
,Caverphone2
Encodes a string into a Caverphone value.
This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 2.0
algorithm:
This class is immutable and thread-safe.
- Since:
- 1.5
- See Also:
-
Constructor Details
-
AbstractCaverphone
public AbstractCaverphone()
-
-
Method Details
-
encode
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 typeString
.- Specified by:
encode
in interfaceEncoder
- Parameters:
source
- Object to encode- Returns:
- An object (or type
String
) containing the caverphone code which corresponds to the String supplied. - Throws:
EncoderException
- if the parameter supplied is not of typeString
.
-
isEncodeEqual
Tests if the encodings of two strings are equal. This method might be promoted to a new AbstractStringEncoder superclass.- Parameters:
str1
- First of two strings to comparestr2
- Second of two strings to compare- Returns:
true
if the encodings of these strings are identical,false
otherwise.- Throws:
EncoderException
- thrown if there is an error condition during the encoding process.
-