ggregory    2003/11/07 14:38:03

  Modified:    codec/src/java/org/apache/commons/codec/language
                        Metaphone.java
  Log:
  Minor clean ups along with improving code coverge as reported by clover from ~61% to 
~80% with more test data.
  
  Revision  Changes    Path
  1.9       +6 -5      
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Metaphone.java    12 Oct 2003 19:48:14 -0000      1.8
  +++ Metaphone.java    7 Nov 2003 22:38:03 -0000       1.9
  @@ -71,6 +71,7 @@
    * @author [EMAIL PROTECTED]
    * @author [EMAIL PROTECTED]
    * @author Tim O'Brien
  + * @author Gary Gregory
    * @version $Id$
    */
   public class Metaphone implements StringEncoder {
  @@ -169,7 +170,7 @@
           int wdsz = local.length();
           int n = 0 ;
   
  -        while ((mtsz < maxCodeLen) && (n < wdsz)) { // max code size of 4 works well
  +        while ((mtsz < this.getMaxCodeLen()) && (n < wdsz)) { // max code size of 4 
works well
               char symb = local.charAt(n) ;
               // remove duplicate letters except C
               if ((symb != 'C') && (n > 0) && (local.charAt(n - 1) == symb)) {
  @@ -339,7 +340,7 @@
                   } // end switch
                   n++ ;
               } // end else from symb != 'C'
  -            if (mtsz > maxCodeLen) { code.setLength(maxCodeLen); }
  +            if (mtsz > this.getMaxCodeLen()) { 
code.setLength(this.getMaxCodeLen()); }
           }
           return code.toString();
       } 
  @@ -375,7 +376,7 @@
        * @throws EncoderException thrown if a Metaphone specific exception
        *                          is encountered.
        */
  -    public String encode(String pString) throws EncoderException {
  +    public String encode(String pString) {
           return (metaphone(pString));   
       }
   
  @@ -395,7 +396,7 @@
        * Returns the maxCodeLen.
        * @return int
        */
  -    public int getMaxCodeLen() { return maxCodeLen; }
  +    public int getMaxCodeLen() { return this.maxCodeLen; }
   
       /**
        * Sets the maxCodeLen.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to