ggregory 2003/11/07 13:32:41 Modified: codec/src/java/org/apache/commons/codec/language DoubleMetaphone.java Log: Clean ups along with improving code coverge as reported by clover from ~45% to ~85% with more test data. Revision Changes Path 1.13 +10 -9 jakarta-commons/codec/src/java/org/apache/commons/codec/language/DoubleMetaphone.java Index: DoubleMetaphone.java =================================================================== RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/language/DoubleMetaphone.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- DoubleMetaphone.java 12 Oct 2003 19:56:13 -0000 1.12 +++ DoubleMetaphone.java 7 Nov 2003 21:32:41 -0000 1.13 @@ -72,6 +72,7 @@ * </ul> * * @author <a href="mailto:[EMAIL PROTECTED]">Benjamin Walstrum</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Gary Gregory</a> * @version $Id$ */ public class DoubleMetaphone implements StringEncoder { @@ -132,7 +133,7 @@ boolean slavoGermanic = isSlavoGermanic(value); int index = isSilentStart(value) ? 1 : 0; - DoubleMetaphoneResult result = new DoubleMetaphoneResult(maxCodeLen); + DoubleMetaphoneResult result = new DoubleMetaphoneResult(this.getMaxCodeLen()); while (!result.isComplete() && index <= value.length() - 1) { switch (value.charAt(index)) { @@ -240,7 +241,7 @@ public Object encode(Object obj) throws EncoderException { if (!(obj instanceof String)) { - throw new EncoderException("Parameter supplied to Metaphone encode is not of type java.lang.String"); + throw new EncoderException("DoubleMetaphone encode parameter is not of type java.lang.String"); } else { return doubleMetaphone((String) obj); } @@ -254,7 +255,7 @@ * @throws EncoderException thrown if there is an exception during * the encoding process. */ - public String encode(String value) throws EncoderException { + public String encode(String value) { return (doubleMetaphone(value)); } @@ -282,7 +283,7 @@ * @return int */ public int getMaxCodeLen() { - return maxCodeLen; + return this.maxCodeLen; } /** @@ -1069,8 +1070,8 @@ */ public class DoubleMetaphoneResult { - private StringBuffer primary = new StringBuffer(maxCodeLen); - private StringBuffer alternate = new StringBuffer(maxCodeLen); + private StringBuffer primary = new StringBuffer(getMaxCodeLen()); + private StringBuffer alternate = new StringBuffer(getMaxCodeLen()); private int maxLength; public DoubleMetaphoneResult(int maxLength) { @@ -1128,11 +1129,11 @@ } public String getPrimary() { - return primary.toString(); + return this.primary.toString(); } public String getAlternate() { - return alternate.toString(); + return this.alternate.toString(); } public boolean isComplete() {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]