7272 * @author bayard@generationjava.com
7373 * @author Tim O'Brien
7474 * @author Gary Gregory
75- * @version $Id: Metaphone.java,v 1.11 2003/11/24 00:11:56 ggregory Exp $
75+ * @version $Id: Metaphone.java,v 1.12 2003/12/04 17:43:04 ggregory Exp $
7676 */
7777public class Metaphone implements StringEncoder {
7878
@@ -193,14 +193,14 @@ public String metaphone(String txt) {
193193 break ;
194194 case 'C' : // lots of C special cases
195195 /* discard if SCI, SCE or SCY */
196- if ((n > 0 ) && (local .charAt (n - 1 ) == 'S' ) && (n + 1 < wdsz ) && (frontv .indexOf (local .charAt (n + 1 )) >= 0 )) {
196+ if ((n > 0 ) && (local .charAt (n - 1 ) == 'S' ) && (n + 1 < wdsz ) && (this . frontv .indexOf (local .charAt (n + 1 )) >= 0 )) {
197197 break ;
198198 }
199199 tmpS = local .toString ();
200200 if (tmpS .indexOf ("CIA" , n ) == n ) { // "CIA" -> X
201201 code .append ('X' ); mtsz ++; break ;
202202 }
203- if ((n + 1 < wdsz ) && (frontv .indexOf (local .charAt (n + 1 )) >= 0 )) {
203+ if ((n + 1 < wdsz ) && (this . frontv .indexOf (local .charAt (n + 1 )) >= 0 )) {
204204 code .append ('S' );
205205 mtsz ++;
206206 break ; // CI,CE,CY -> S
@@ -211,7 +211,7 @@ public String metaphone(String txt) {
211211 break ;
212212 }
213213 if (tmpS .indexOf ("CH" , n ) == n ) { // detect CH
214- if ((n == 0 ) && (wdsz >= 3 ) && (vowels .indexOf (local .charAt (2 )) < 0 )) { // CH consonant -> K consonant
214+ if ((n == 0 ) && (wdsz >= 3 ) && (this . vowels .indexOf (local .charAt (2 )) < 0 )) { // CH consonant -> K consonant
215215 code .append ('K' );
216216 } else {
217217 code .append ('X' ); // CHvowel -> X
@@ -223,7 +223,7 @@ public String metaphone(String txt) {
223223 }
224224 break ;
225225 case 'D' :
226- if ((n + 2 < wdsz ) && (local .charAt (n + 1 ) == 'G' ) && (frontv .indexOf (local .charAt (n + 2 )) >= 0 )) { // DGE DGI DGY -> J
226+ if ((n + 2 < wdsz ) && (local .charAt (n + 1 ) == 'G' ) && (this . frontv .indexOf (local .charAt (n + 2 )) >= 0 )) { // DGE DGI DGY -> J
227227 code .append ('J' ); n += 2 ;
228228 } else {
229229 code .append ('T' );
@@ -234,7 +234,7 @@ public String metaphone(String txt) {
234234 if ((n + 2 == wdsz ) && (local .charAt (n + 1 ) == 'H' )) {
235235 break ;
236236 }
237- if ((n + 2 < wdsz ) && (local .charAt (n + 1 ) == 'H' ) && (vowels .indexOf (local .charAt (n + 2 )) < 0 )) {
237+ if ((n + 2 < wdsz ) && (local .charAt (n + 1 ) == 'H' ) && (this . vowels .indexOf (local .charAt (n + 2 )) < 0 )) {
238238 break ;
239239 }
240240 tmpS = local .toString ();
@@ -246,7 +246,7 @@ public String metaphone(String txt) {
246246 } else {
247247 hard = false ;
248248 }
249- if ((n + 1 < wdsz ) && (frontv .indexOf (local .charAt (n + 1 )) >= 0 ) && (!hard )) {
249+ if ((n + 1 < wdsz ) && (this . frontv .indexOf (local .charAt (n + 1 )) >= 0 ) && (!hard )) {
250250 code .append ('J' );
251251 } else {
252252 code .append ('K' );
@@ -257,10 +257,10 @@ public String metaphone(String txt) {
257257 if (n + 1 == wdsz ) {
258258 break ; // terminal H
259259 }
260- if ((n > 0 ) && (varson .indexOf (local .charAt (n - 1 )) >= 0 )) {
260+ if ((n > 0 ) && (this . varson .indexOf (local .charAt (n - 1 )) >= 0 )) {
261261 break ;
262262 }
263- if (vowels .indexOf (local .charAt (n + 1 )) >= 0 ) {
263+ if (this . vowels .indexOf (local .charAt (n + 1 )) >= 0 ) {
264264 code .append ('H' );
265265 mtsz ++;// Hvowel
266266 }
@@ -327,7 +327,7 @@ public String metaphone(String txt) {
327327 case 'V' :
328328 code .append ('F' ); mtsz ++;break ;
329329 case 'W' : case 'Y' : // silent if not followed by vowel
330- if ((n + 1 < wdsz ) && (vowels .indexOf (local .charAt (n + 1 )) >= 0 )) {
330+ if ((n + 1 < wdsz ) && (this . vowels .indexOf (local .charAt (n + 1 )) >= 0 )) {
331331 code .append (symb );
332332 mtsz ++;
333333 }
0 commit comments