commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec/language Metaphone.java DoubleMetaphone.java
Date Thu, 04 Dec 2003 17:43:04 GMT
ggregory    2003/12/04 09:43:04

  Modified:    codec/src/java/org/apache/commons/codec/language
                        Metaphone.java DoubleMetaphone.java
  Log:
  Add missing Javadoc tags on public methods. Compiler warnings WRT unqualified instance variable
access (added "this.").
  
  Revision  Changes    Path
  1.12      +10 -10    jakarta-commons/codec/src/java/org/apache/commons/codec/language/Metaphone.java
  
  Index: Metaphone.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/language/Metaphone.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Metaphone.java	24 Nov 2003 00:11:56 -0000	1.11
  +++ Metaphone.java	4 Dec 2003 17:43:04 -0000	1.12
  @@ -193,14 +193,14 @@
                       break;
                   case 'C' : // lots of C special cases
                       /* discard if SCI, SCE or SCY */
  -                    if ((n > 0) && (local.charAt(n - 1) == 'S') && (n
+ 1 < wdsz) && (frontv.indexOf(local.charAt(n + 1)) >= 0)) { 
  +                    if ((n > 0) && (local.charAt(n - 1) == 'S') && (n
+ 1 < wdsz) && (this.frontv.indexOf(local.charAt(n + 1)) >= 0)) { 
                           break ;
                       }
                       tmpS = local.toString();
                       if (tmpS.indexOf("CIA", n) == n) { // "CIA" -> X
                           code.append('X'); mtsz++; break ;
                       }
  -                    if ((n + 1 < wdsz) && (frontv.indexOf(local.charAt(n + 1))
>= 0)) {
  +                    if ((n + 1 < wdsz) && (this.frontv.indexOf(local.charAt(n
+ 1)) >= 0)) {
                           code.append('S');
                           mtsz++; 
                           break ; // CI,CE,CY -> S
  @@ -211,7 +211,7 @@
                           break ;
                       }
                       if (tmpS.indexOf("CH", n) == n) { // detect CH
  -                        if ((n == 0) && (wdsz >= 3) && (vowels.indexOf(local.charAt(2))
< 0)) { // CH consonant -> K consonant
  +                        if ((n == 0) && (wdsz >= 3) && (this.vowels.indexOf(local.charAt(2))
< 0)) { // CH consonant -> K consonant
                               code.append('K');
                           } else { 
                               code.append('X'); // CHvowel -> X
  @@ -223,7 +223,7 @@
                       }
                       break ;
                   case 'D' :
  -                    if ((n + 2 < wdsz)   && (local.charAt(n + 1) == 'G') &&
(frontv.indexOf(local.charAt(n + 2)) >= 0)) { // DGE DGI DGY -> J 
  +                    if ((n + 2 < wdsz)   && (local.charAt(n + 1) == 'G') &&
(this.frontv.indexOf(local.charAt(n + 2)) >= 0)) { // DGE DGI DGY -> J 
                           code.append('J'); n += 2 ;
                       } else { 
                           code.append('T');
  @@ -234,7 +234,7 @@
                       if ((n + 2 == wdsz) && (local.charAt(n + 1) == 'H')) {
                           break;
                       }
  -                    if ((n + 2 < wdsz) && (local.charAt(n + 1) == 'H') &&
(vowels.indexOf(local.charAt(n + 2)) < 0)) {
  +                    if ((n + 2 < wdsz) && (local.charAt(n + 1) == 'H') &&
(this.vowels.indexOf(local.charAt(n + 2)) < 0)) {
                           break;
                       }
                       tmpS = local.toString();
  @@ -246,7 +246,7 @@
                       } else {
                           hard = false ;
                       }
  -                    if ((n + 1 < wdsz) && (frontv.indexOf(local.charAt(n + 1))
>= 0) && (!hard)) {
  +                    if ((n + 1 < wdsz) && (this.frontv.indexOf(local.charAt(n
+ 1)) >= 0) && (!hard)) {
                           code.append('J');
                       } else {
                           code.append('K');
  @@ -257,10 +257,10 @@
                       if (n + 1 == wdsz) {
                           break ; // terminal H
                       }
  -                    if ((n > 0) && (varson.indexOf(local.charAt(n - 1)) >=
0)) {
  +                    if ((n > 0) && (this.varson.indexOf(local.charAt(n - 1))
>= 0)) {
                           break;
                       }
  -                    if (vowels.indexOf(local.charAt(n + 1)) >= 0) {
  +                    if (this.vowels.indexOf(local.charAt(n + 1)) >= 0) {
                           code.append('H'); 
                           mtsz++;// Hvowel
                       }
  @@ -327,7 +327,7 @@
                   case 'V' :
                       code.append('F'); mtsz++;break ;
                   case 'W' : case 'Y' : // silent if not followed by vowel
  -                    if ((n + 1 < wdsz) && (vowels.indexOf(local.charAt(n + 1))
>= 0)) {
  +                    if ((n + 1 < wdsz) && (this.vowels.indexOf(local.charAt(n
+ 1)) >= 0)) {
                           code.append(symb);
                           mtsz++;
                       }
  
  
  
  1.16      +17 -4     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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DoubleMetaphone.java	24 Nov 2003 00:11:56 -0000	1.15
  +++ DoubleMetaphone.java	4 Dec 2003 17:43:04 -0000	1.16
  @@ -237,11 +237,12 @@
        *
        * @param obj Object to encode (should be of type String)
        * @return An encoded Object (will be of type String)
  +     * @throws EncoderException encode parameter is not of type String
        */
       public Object encode(Object obj) throws EncoderException {
   
           if (!(obj instanceof String)) {
  -            throw new EncoderException("DoubleMetaphone encode parameter is not of type
java.lang.String"); 
  +            throw new EncoderException("DoubleMetaphone encode parameter is not of type
String"); 
           } else {
               return doubleMetaphone((String) obj);
           }
  @@ -259,7 +260,13 @@
   
       /**
        * Check if the Double Metaphone values of two <code>String</code> values
  -     * are equal
  +     * are equal.
  +     * 
  +     * @param value1 The left-hand side of the encoded {@link String#equals(Object)}.
  +     * @param value2 The right-hand side of the encoded {@link String#equals(Object)}.
  +     * @return <code>true</code> if the encoded <code>String</code>s
are equal;
  +     *          <code>false</code> otherwise.
  +     * @see #isDoubleMetaphoneEqual(String,String,boolean)
        */
       public boolean isDoubleMetaphoneEqual(String value1, String value2) {
           return isDoubleMetaphoneEqual(value1, value2, false);
  @@ -267,7 +274,13 @@
       
       /**
        * Check if the Double Metaphone values of two <code>String</code> values
  -     * are equal, optionally using the alternate value
  +     * are equal, optionally using the alternate value.
  +     * 
  +     * @param value1 The left-hand side of the encoded {@link String#equals(Object)}.
  +     * @param value2 The right-hand side of the encoded {@link String#equals(Object)}.
  +     * @param alternate use the alternate value if <code>true</code>.
  +     * @return <code>true</code> if the encoded <code>String</code>s
are equal;
  +     *          <code>false</code> otherwise.
        */
       public boolean isDoubleMetaphoneEqual(String value1, 
                                             String value2, 
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message