7171 * @author wbrogden@bga.com
7272 * @author bayard@generationjava.com
7373 * @author Tim O'Brien
74- * @version $Id: Metaphone.java,v 1.8 2003/10/12 19:48:14 tobrien Exp $
74+ * @author Gary Gregory
75+ * @version $Id: Metaphone.java,v 1.9 2003/11/07 22:38:03 ggregory Exp $
7576 */
7677public class Metaphone implements StringEncoder {
7778
@@ -169,7 +170,7 @@ public String metaphone(String txt) {
169170 int wdsz = local .length ();
170171 int n = 0 ;
171172
172- while ((mtsz < maxCodeLen ) && (n < wdsz )) { // max code size of 4 works well
173+ while ((mtsz < this . getMaxCodeLen () ) && (n < wdsz )) { // max code size of 4 works well
173174 char symb = local .charAt (n ) ;
174175 // remove duplicate letters except C
175176 if ((symb != 'C' ) && (n > 0 ) && (local .charAt (n - 1 ) == symb )) {
@@ -339,7 +340,7 @@ public String metaphone(String txt) {
339340 } // end switch
340341 n ++ ;
341342 } // end else from symb != 'C'
342- if (mtsz > maxCodeLen ) { code .setLength (maxCodeLen ); }
343+ if (mtsz > this . getMaxCodeLen ()) { code .setLength (this . getMaxCodeLen () ); }
343344 }
344345 return code .toString ();
345346 }
@@ -375,7 +376,7 @@ public Object encode(Object pObject) throws EncoderException {
375376 * @throws EncoderException thrown if a Metaphone specific exception
376377 * is encountered.
377378 */
378- public String encode (String pString ) throws EncoderException {
379+ public String encode (String pString ) {
379380 return (metaphone (pString ));
380381 }
381382
@@ -395,7 +396,7 @@ public boolean isMetaphoneEqual(String str1, String str2) {
395396 * Returns the maxCodeLen.
396397 * @return int
397398 */
398- public int getMaxCodeLen () { return maxCodeLen ; }
399+ public int getMaxCodeLen () { return this . maxCodeLen ; }
399400
400401 /**
401402 * Sets the maxCodeLen.
0 commit comments