Skip to content

Commit 5563aa7

Browse files
committed
Add missing Javadoc tags on public methods. Compiler warnings WRT unqualified instance variable access (added "this.").
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/codec/trunk@130264 13f79535-47bb-0310-9956-ffa450edef68
1 parent 931849f commit 5563aa7

2 files changed

Lines changed: 27 additions & 14 deletions

File tree

src/java/org/apache/commons/codec/language/DoubleMetaphone.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
*
7474
* @author <a href="mailto:ben@walstrum.com">Benjamin Walstrum</a>
7575
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
76-
* @version $Id: DoubleMetaphone.java,v 1.15 2003/11/24 00:11:56 ggregory Exp $
76+
* @version $Id: DoubleMetaphone.java,v 1.16 2003/12/04 17:43:04 ggregory Exp $
7777
*/
7878
public class DoubleMetaphone implements StringEncoder {
7979

@@ -237,11 +237,12 @@ public String doubleMetaphone(String value, boolean alternate) {
237237
*
238238
* @param obj Object to encode (should be of type String)
239239
* @return An encoded Object (will be of type String)
240+
* @throws EncoderException encode parameter is not of type String
240241
*/
241242
public Object encode(Object obj) throws EncoderException {
242243

243244
if (!(obj instanceof String)) {
244-
throw new EncoderException("DoubleMetaphone encode parameter is not of type java.lang.String");
245+
throw new EncoderException("DoubleMetaphone encode parameter is not of type String");
245246
} else {
246247
return doubleMetaphone((String) obj);
247248
}
@@ -259,15 +260,27 @@ public String encode(String value) {
259260

260261
/**
261262
* Check if the Double Metaphone values of two <code>String</code> values
262-
* are equal
263+
* are equal.
264+
*
265+
* @param value1 The left-hand side of the encoded {@link String#equals(Object)}.
266+
* @param value2 The right-hand side of the encoded {@link String#equals(Object)}.
267+
* @return <code>true</code> if the encoded <code>String</code>s are equal;
268+
* <code>false</code> otherwise.
269+
* @see #isDoubleMetaphoneEqual(String,String,boolean)
263270
*/
264271
public boolean isDoubleMetaphoneEqual(String value1, String value2) {
265272
return isDoubleMetaphoneEqual(value1, value2, false);
266273
}
267274

268275
/**
269276
* Check if the Double Metaphone values of two <code>String</code> values
270-
* are equal, optionally using the alternate value
277+
* are equal, optionally using the alternate value.
278+
*
279+
* @param value1 The left-hand side of the encoded {@link String#equals(Object)}.
280+
* @param value2 The right-hand side of the encoded {@link String#equals(Object)}.
281+
* @param alternate use the alternate value if <code>true</code>.
282+
* @return <code>true</code> if the encoded <code>String</code>s are equal;
283+
* <code>false</code> otherwise.
271284
*/
272285
public boolean isDoubleMetaphoneEqual(String value1,
273286
String value2,

src/java/org/apache/commons/codec/language/Metaphone.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
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
*/
7777
public 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

Comments
 (0)