7272 * </ul>
7373 *
7474 * @author <a href="mailto:ben@walstrum.com">Benjamin Walstrum</a>
75- * @version $Id: DoubleMetaphone.java,v 1.12 2003/10/12 19:56:13 tobrien Exp $
75+ * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
76+ * @version $Id: DoubleMetaphone.java,v 1.13 2003/11/07 21:32:41 ggregory Exp $
7677 */
7778public class DoubleMetaphone implements StringEncoder {
7879
@@ -132,7 +133,7 @@ public String doubleMetaphone(String value, boolean alternate) {
132133 boolean slavoGermanic = isSlavoGermanic (value );
133134 int index = isSilentStart (value ) ? 1 : 0 ;
134135
135- DoubleMetaphoneResult result = new DoubleMetaphoneResult (maxCodeLen );
136+ DoubleMetaphoneResult result = new DoubleMetaphoneResult (this . getMaxCodeLen () );
136137
137138 while (!result .isComplete () && index <= value .length () - 1 ) {
138139 switch (value .charAt (index )) {
@@ -240,7 +241,7 @@ public String doubleMetaphone(String value, boolean alternate) {
240241 public Object encode (Object obj ) throws EncoderException {
241242
242243 if (!(obj instanceof String )) {
243- throw new EncoderException ("Parameter supplied to Metaphone encode is not of type java.lang.String" );
244+ throw new EncoderException ("DoubleMetaphone encode parameter is not of type java.lang.String" );
244245 } else {
245246 return doubleMetaphone ((String ) obj );
246247 }
@@ -254,7 +255,7 @@ public Object encode(Object obj) throws EncoderException {
254255 * @throws EncoderException thrown if there is an exception during
255256 * the encoding process.
256257 */
257- public String encode (String value ) throws EncoderException {
258+ public String encode (String value ) {
258259 return (doubleMetaphone (value ));
259260 }
260261
@@ -282,7 +283,7 @@ public boolean isDoubleMetaphoneEqual(String value1,
282283 * @return int
283284 */
284285 public int getMaxCodeLen () {
285- return maxCodeLen ;
286+ return this . maxCodeLen ;
286287 }
287288
288289 /**
@@ -1069,8 +1070,8 @@ protected static boolean contains(String value, int start, int length,
10691070 */
10701071 public class DoubleMetaphoneResult {
10711072
1072- private StringBuffer primary = new StringBuffer (maxCodeLen );
1073- private StringBuffer alternate = new StringBuffer (maxCodeLen );
1073+ private StringBuffer primary = new StringBuffer (getMaxCodeLen () );
1074+ private StringBuffer alternate = new StringBuffer (getMaxCodeLen () );
10741075 private int maxLength ;
10751076
10761077 public DoubleMetaphoneResult (int maxLength ) {
@@ -1128,11 +1129,11 @@ public void appendAlternate(String value) {
11281129 }
11291130
11301131 public String getPrimary () {
1131- return primary .toString ();
1132+ return this . primary .toString ();
11321133 }
11331134
11341135 public String getAlternate () {
1135- return alternate .toString ();
1136+ return this . alternate .toString ();
11361137 }
11371138
11381139 public boolean isComplete () {
0 commit comments