commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1306466 - in /commons/proper/codec/trunk/src: main/java/org/apache/commons/codec/language/ main/java/org/apache/commons/codec/language/bm/ main/java/org/apache/commons/codec/net/ test/java/org/apache/commons/codec/binary/ test/java/org/apa...
Date Wed, 28 Mar 2012 17:02:21 GMT
Author: ggregory
Date: Wed Mar 28 17:02:20 2012
New Revision: 1306466

URL: http://svn.apache.org/viewvc?rev=1306466&view=rev
Log:
Remove extra parens.

Modified:
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Soundex.java
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/bm/Rule.java
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
    commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/binary/Base64Test.java
    commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/SoundexTest.java
    commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/RuleTest.java

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java?rev=1306466&r1=1306465&r2=1306466&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Metaphone.java
Wed Mar 28 17:02:20 2012
@@ -81,7 +81,7 @@ public class Metaphone implements String
      */
     public String metaphone(String txt) {
         boolean hard = false ;
-        if ((txt == null) || (txt.length() == 0)) {
+        if (txt == null || txt.length() == 0) {
             return "" ;
         }
         // single character is itself
@@ -134,11 +134,11 @@ public class Metaphone implements String
         int wdsz = local.length();
         int n = 0 ;
 
-        while ((code.length() < this.getMaxCodeLen()) && 
-               (n < wdsz) ) { // max code size of 4 works well
+        while (code.length() < this.getMaxCodeLen() && 
+               n < wdsz ) { // max code size of 4 works well
             char symb = local.charAt(n) ;
             // remove duplicate letters except C
-            if ((symb != 'C') && (isPreviousChar( local, n, symb )) ) {
+            if (symb != 'C' && isPreviousChar( local, n, symb ) ) {
                 n++ ;
             } else { // not dup
                 switch(symb) {
@@ -158,7 +158,7 @@ public class Metaphone implements String
                     /* discard if SCI, SCE or SCY */
                     if ( isPreviousChar(local, n, 'S') && 
                          !isLastChar(wdsz, n) && 
-                         (FRONTV.indexOf(local.charAt(n + 1)) >= 0) ) { 
+                         FRONTV.indexOf(local.charAt(n + 1)) >= 0 ) { 
                         break;
                     }
                     if (regionMatch(local, n, "CIA")) { // "CIA" -> X
@@ -166,7 +166,7 @@ public class Metaphone implements String
                         break;
                     }
                     if (!isLastChar(wdsz, n) && 
-                        (FRONTV.indexOf(local.charAt(n + 1)) >= 0)) {
+                        FRONTV.indexOf(local.charAt(n + 1)) >= 0) {
                         code.append('S');
                         break; // CI,CE,CY -> S
                     }
@@ -176,8 +176,8 @@ public class Metaphone implements String
                         break ;
                     }
                     if (isNextChar(local, n, 'H')) { // detect CH
-                        if ((n == 0) && 
-                            (wdsz >= 3) && 
+                        if (n == 0 && 
+                            wdsz >= 3 && 
                             isVowel(local,2) ) { // CH consonant -> K consonant
                             code.append('K');
                         } else { 
@@ -190,7 +190,7 @@ public class Metaphone implements String
                 case 'D' :
                     if (!isLastChar(wdsz, n + 1) && 
                         isNextChar(local, n, 'G') && 
-                        (FRONTV.indexOf(local.charAt(n + 2)) >= 0)) { // DGE DGI DGY ->
J 
+                        FRONTV.indexOf(local.charAt(n + 2)) >= 0) { // DGE DGI DGY ->
J 
                         code.append('J'); n += 2 ;
                     } else { 
                         code.append('T');
@@ -206,7 +206,7 @@ public class Metaphone implements String
                         !isVowel(local,n+2)) {
                         break;
                     }
-                    if ((n > 0) && 
+                    if (n > 0 && 
                         ( regionMatch(local, n, "GN") ||
                           regionMatch(local, n, "GNED") ) ) {
                         break; // silent G
@@ -218,8 +218,8 @@ public class Metaphone implements String
                         hard = false ;
                     }
                     if (!isLastChar(wdsz, n) && 
-                        (FRONTV.indexOf(local.charAt(n + 1)) >= 0) && 
-                        (!hard)) {
+                        FRONTV.indexOf(local.charAt(n + 1)) >= 0 && 
+                        !hard) {
                         code.append('J');
                     } else {
                         code.append('K');
@@ -229,8 +229,8 @@ public class Metaphone implements String
                     if (isLastChar(wdsz, n)) {
                         break ; // terminal H
                     }
-                    if ((n > 0) && 
-                        (VARSON.indexOf(local.charAt(n - 1)) >= 0)) {
+                    if (n > 0 && 
+                        VARSON.indexOf(local.charAt(n - 1)) >= 0) {
                         break;
                     }
                     if (isVowel(local,n+1)) {
@@ -339,7 +339,7 @@ public class Metaphone implements String
     private boolean regionMatch(StringBuffer string, int index, String test) {
         boolean matches = false;
         if( index >= 0 &&
-            (index + test.length() - 1) < string.length() ) {
+            index + test.length() - 1 < string.length() ) {
             String substring = string.substring( index, index + test.length());
             matches = substring.equals( test );
         }

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Soundex.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Soundex.java?rev=1306466&r1=1306465&r2=1306466&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Soundex.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Soundex.java
Wed Mar 28 17:02:20 2012
@@ -265,10 +265,10 @@ public class Soundex implements StringEn
         out[0] = str.charAt(0);
         // getMappingCode() throws IllegalArgumentException
         last = getMappingCode(str, 0);
-        while ((incount < str.length()) && (count < out.length)) {
+        while (incount < str.length() && count < out.length) {
             mapped = getMappingCode(str, incount++);
             if (mapped != 0) {
-                if ((mapped != '0') && (mapped != last)) {
+                if (mapped != '0' && mapped != last) {
                     out[count++] = mapped;
                 }
                 last = mapped;

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/bm/Rule.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/bm/Rule.java?rev=1306466&r1=1306465&r2=1306466&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/bm/Rule.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/bm/Rule.java
Wed Mar 28 17:02:20 2012
@@ -462,21 +462,21 @@ public class Rule {
                         // exact match
                         return new RPattern() {
                             public boolean isMatch(CharSequence input) {
-                                return input.length() == 1 && (contains(bContent,
input.charAt(0)) == shouldMatch);
+                                return input.length() == 1 && contains(bContent,
input.charAt(0)) == shouldMatch;
                             }
                         };
                     } else if (startsWith) {
                         // first char
                         return new RPattern() {
                             public boolean isMatch(CharSequence input) {
-                                return input.length() > 0 && (contains(bContent,
input.charAt(0)) == shouldMatch);
+                                return input.length() > 0 && contains(bContent,
input.charAt(0)) == shouldMatch;
                             }
                         };
                     } else if (endsWith) {
                         // last char
                         return new RPattern() {
                             public boolean isMatch(CharSequence input) {
-                                return input.length() > 0 && (contains(bContent,
input.charAt(input.length() - 1)) == shouldMatch);
+                                return input.length() > 0 && contains(bContent,
input.charAt(input.length() - 1)) == shouldMatch;
                             }
                         };
                     }

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java?rev=1306466&r1=1306465&r2=1306466&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
Wed Mar 28 17:02:20 2012
@@ -140,7 +140,7 @@ abstract class RFC1522Codec {
         if (text == null) {
             return null;
         }
-        if ((!text.startsWith(PREFIX)) || (!text.endsWith(POSTFIX))) {
+        if (!text.startsWith(PREFIX) || !text.endsWith(POSTFIX)) {
             throw new DecoderException("RFC 1522 violation: malformed encoded content");
         }
         int terminator = text.length() - 2;

Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/binary/Base64Test.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/binary/Base64Test.java?rev=1306466&r1=1306465&r2=1306466&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/binary/Base64Test.java
(original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/binary/Base64Test.java
Wed Mar 28 17:02:20 2012
@@ -58,7 +58,7 @@ public class Base64Test {
         String nullString = null;
         String emptyString = "";
         String validString = "abc===defg\n\r123456\r789\r\rABC\n\nDEF==GHI\r\nJKL==============";
-        String invalidString = validString + ((char)0); // append null character
+        String invalidString = validString + (char)0; // append null character
         
         try {
             Base64.isBase64(nullString);
@@ -340,7 +340,7 @@ public class Base64Test {
             byte[] data = new byte[i];
             this.getRandom().nextBytes(data);
             byte[] enc = Base64.encodeBase64(data);
-            assertTrue("\"" + (new String(enc)) + "\" is Base64 data.", Base64.isBase64(enc));
+            assertTrue("\"" + new String(enc) + "\" is Base64 data.", Base64.isBase64(enc));
             byte[] data2 = Base64.decodeBase64(enc);
             assertTrue(toString(data) + " equals " + toString(data2), Arrays.equals(data,
data2));
         }

Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/SoundexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/SoundexTest.java?rev=1306466&r1=1306465&r2=1306466&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/SoundexTest.java
(original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/SoundexTest.java
Wed Mar 28 17:02:20 2012
@@ -49,7 +49,7 @@ public class SoundexTest extends StringE
 
     @Test
     public void testB650() throws EncoderException {
-        this.checkEncodingVariations("B650", (new String[]{
+        this.checkEncodingVariations("B650", new String[]{
             "BARHAM",
             "BARONE",
             "BARRON",
@@ -89,7 +89,7 @@ public class SoundexTest extends StringE
             "BYRAM",
             "BYRNE",
             "BYRON",
-            "BYRUM"}));
+            "BYRUM"});
     }
 
     @Test
@@ -189,7 +189,7 @@ public class SoundexTest extends StringE
 
     @Test
     public void testEncodeIgnoreApostrophes() throws EncoderException {
-        this.checkEncodingVariations("O165", (new String[]{
+        this.checkEncodingVariations("O165", new String[]{
             "OBrien",
             "'OBrien",
             "O'Brien",
@@ -197,7 +197,7 @@ public class SoundexTest extends StringE
             "OBr'ien",
             "OBri'en",
             "OBrie'n",
-            "OBrien'"}));
+            "OBrien'"});
     }
 
     /**
@@ -207,7 +207,7 @@ public class SoundexTest extends StringE
      */
     @Test
     public void testEncodeIgnoreHyphens() throws EncoderException {
-        this.checkEncodingVariations("K525", (new String[]{
+        this.checkEncodingVariations("K525", new String[]{
             "KINGSMITH",
             "-KINGSMITH",
             "K-INGSMITH",
@@ -218,7 +218,7 @@ public class SoundexTest extends StringE
             "KINGSM-ITH",
             "KINGSMI-TH",
             "KINGSMIT-H",
-            "KINGSMITH-"}));
+            "KINGSMITH-"});
     }
 
     @Test
@@ -259,7 +259,7 @@ public class SoundexTest extends StringE
         Assert.assertEquals("S460", this.getSoundexEncoder().encode("Sgler"));
         Assert.assertEquals("S460", this.getSoundexEncoder().encode("Swhgler"));
         // Also S460:
-        this.checkEncodingVariations("S460", (new String[]{
+        this.checkEncodingVariations("S460", new String[]{
             "SAILOR",
             "SALYER",
             "SAYLOR",
@@ -275,7 +275,7 @@ public class SoundexTest extends StringE
             "SHULER",
             "SILAR",
             "SILER",
-            "SILLER"}));
+            "SILLER"});
     }
 
     /**
@@ -297,7 +297,7 @@ public class SoundexTest extends StringE
      */
     @Test
     public void testMsSqlServer2() throws EncoderException {
-        this.checkEncodingVariations("E625", (new String[]{"Erickson", "Erickson", "Erikson",
"Ericson", "Ericksen", "Ericsen"}));
+        this.checkEncodingVariations("E625", new String[]{"Erickson", "Erickson", "Erikson",
"Ericson", "Ericksen", "Ericsen"});
     }
 
     /**

Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/RuleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/RuleTest.java?rev=1306466&r1=1306465&r2=1306466&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/RuleTest.java
(original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/language/bm/RuleTest.java
Wed Mar 28 17:02:20 2012
@@ -36,7 +36,7 @@ public class RuleTest {
         }
 
         public boolean matches(Object item) {
-            return ((Integer) item) < 0;
+            return (Integer) item < 0;
         }
     }
 



Mime
View raw message