Skip to content

Commit 8f868d0

Browse files
committed
Remove extra parens.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1306466 13f79535-47bb-0310-9956-ffa450edef68
1 parent 7c622a0 commit 8f868d0

7 files changed

Lines changed: 33 additions & 33 deletions

File tree

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public Metaphone() {
8181
*/
8282
public String metaphone(String txt) {
8383
boolean hard = false ;
84-
if ((txt == null) || (txt.length() == 0)) {
84+
if (txt == null || txt.length() == 0) {
8585
return "" ;
8686
}
8787
// single character is itself
@@ -134,11 +134,11 @@ public String metaphone(String txt) {
134134
int wdsz = local.length();
135135
int n = 0 ;
136136

137-
while ((code.length() < this.getMaxCodeLen()) &&
138-
(n < wdsz) ) { // max code size of 4 works well
137+
while (code.length() < this.getMaxCodeLen() &&
138+
n < wdsz ) { // max code size of 4 works well
139139
char symb = local.charAt(n) ;
140140
// remove duplicate letters except C
141-
if ((symb != 'C') && (isPreviousChar( local, n, symb )) ) {
141+
if (symb != 'C' && isPreviousChar( local, n, symb ) ) {
142142
n++ ;
143143
} else { // not dup
144144
switch(symb) {
@@ -158,15 +158,15 @@ public String metaphone(String txt) {
158158
/* discard if SCI, SCE or SCY */
159159
if ( isPreviousChar(local, n, 'S') &&
160160
!isLastChar(wdsz, n) &&
161-
(FRONTV.indexOf(local.charAt(n + 1)) >= 0) ) {
161+
FRONTV.indexOf(local.charAt(n + 1)) >= 0 ) {
162162
break;
163163
}
164164
if (regionMatch(local, n, "CIA")) { // "CIA" -> X
165165
code.append('X');
166166
break;
167167
}
168168
if (!isLastChar(wdsz, n) &&
169-
(FRONTV.indexOf(local.charAt(n + 1)) >= 0)) {
169+
FRONTV.indexOf(local.charAt(n + 1)) >= 0) {
170170
code.append('S');
171171
break; // CI,CE,CY -> S
172172
}
@@ -176,8 +176,8 @@ public String metaphone(String txt) {
176176
break ;
177177
}
178178
if (isNextChar(local, n, 'H')) { // detect CH
179-
if ((n == 0) &&
180-
(wdsz >= 3) &&
179+
if (n == 0 &&
180+
wdsz >= 3 &&
181181
isVowel(local,2) ) { // CH consonant -> K consonant
182182
code.append('K');
183183
} else {
@@ -190,7 +190,7 @@ public String metaphone(String txt) {
190190
case 'D' :
191191
if (!isLastChar(wdsz, n + 1) &&
192192
isNextChar(local, n, 'G') &&
193-
(FRONTV.indexOf(local.charAt(n + 2)) >= 0)) { // DGE DGI DGY -> J
193+
FRONTV.indexOf(local.charAt(n + 2)) >= 0) { // DGE DGI DGY -> J
194194
code.append('J'); n += 2 ;
195195
} else {
196196
code.append('T');
@@ -206,7 +206,7 @@ public String metaphone(String txt) {
206206
!isVowel(local,n+2)) {
207207
break;
208208
}
209-
if ((n > 0) &&
209+
if (n > 0 &&
210210
( regionMatch(local, n, "GN") ||
211211
regionMatch(local, n, "GNED") ) ) {
212212
break; // silent G
@@ -218,8 +218,8 @@ public String metaphone(String txt) {
218218
hard = false ;
219219
}
220220
if (!isLastChar(wdsz, n) &&
221-
(FRONTV.indexOf(local.charAt(n + 1)) >= 0) &&
222-
(!hard)) {
221+
FRONTV.indexOf(local.charAt(n + 1)) >= 0 &&
222+
!hard) {
223223
code.append('J');
224224
} else {
225225
code.append('K');
@@ -229,8 +229,8 @@ public String metaphone(String txt) {
229229
if (isLastChar(wdsz, n)) {
230230
break ; // terminal H
231231
}
232-
if ((n > 0) &&
233-
(VARSON.indexOf(local.charAt(n - 1)) >= 0)) {
232+
if (n > 0 &&
233+
VARSON.indexOf(local.charAt(n - 1)) >= 0) {
234234
break;
235235
}
236236
if (isVowel(local,n+1)) {
@@ -339,7 +339,7 @@ private boolean isNextChar(StringBuffer string, int index, char c) {
339339
private boolean regionMatch(StringBuffer string, int index, String test) {
340340
boolean matches = false;
341341
if( index >= 0 &&
342-
(index + test.length() - 1) < string.length() ) {
342+
index + test.length() - 1 < string.length() ) {
343343
String substring = string.substring( index, index + test.length());
344344
matches = substring.equals( test );
345345
}

src/main/java/org/apache/commons/codec/language/Soundex.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,10 @@ public String soundex(String str) {
265265
out[0] = str.charAt(0);
266266
// getMappingCode() throws IllegalArgumentException
267267
last = getMappingCode(str, 0);
268-
while ((incount < str.length()) && (count < out.length)) {
268+
while (incount < str.length() && count < out.length) {
269269
mapped = getMappingCode(str, incount++);
270270
if (mapped != 0) {
271-
if ((mapped != '0') && (mapped != last)) {
271+
if (mapped != '0' && mapped != last) {
272272
out[count++] = mapped;
273273
}
274274
last = mapped;

src/main/java/org/apache/commons/codec/language/bm/Rule.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,21 +462,21 @@ public boolean isMatch(CharSequence input) {
462462
// exact match
463463
return new RPattern() {
464464
public boolean isMatch(CharSequence input) {
465-
return input.length() == 1 && (contains(bContent, input.charAt(0)) == shouldMatch);
465+
return input.length() == 1 && contains(bContent, input.charAt(0)) == shouldMatch;
466466
}
467467
};
468468
} else if (startsWith) {
469469
// first char
470470
return new RPattern() {
471471
public boolean isMatch(CharSequence input) {
472-
return input.length() > 0 && (contains(bContent, input.charAt(0)) == shouldMatch);
472+
return input.length() > 0 && contains(bContent, input.charAt(0)) == shouldMatch;
473473
}
474474
};
475475
} else if (endsWith) {
476476
// last char
477477
return new RPattern() {
478478
public boolean isMatch(CharSequence input) {
479-
return input.length() > 0 && (contains(bContent, input.charAt(input.length() - 1)) == shouldMatch);
479+
return input.length() > 0 && contains(bContent, input.charAt(input.length() - 1)) == shouldMatch;
480480
}
481481
};
482482
}

src/main/java/org/apache/commons/codec/net/RFC1522Codec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ protected String decodeText(final String text)
140140
if (text == null) {
141141
return null;
142142
}
143-
if ((!text.startsWith(PREFIX)) || (!text.endsWith(POSTFIX))) {
143+
if (!text.startsWith(PREFIX) || !text.endsWith(POSTFIX)) {
144144
throw new DecoderException("RFC 1522 violation: malformed encoded content");
145145
}
146146
int terminator = text.length() - 2;

src/test/java/org/apache/commons/codec/binary/Base64Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void testIsStringBase64() {
5858
String nullString = null;
5959
String emptyString = "";
6060
String validString = "abc===defg\n\r123456\r789\r\rABC\n\nDEF==GHI\r\nJKL==============";
61-
String invalidString = validString + ((char)0); // append null character
61+
String invalidString = validString + (char)0; // append null character
6262

6363
try {
6464
Base64.isBase64(nullString);
@@ -340,7 +340,7 @@ public void testEncodeDecodeSmall() {
340340
byte[] data = new byte[i];
341341
this.getRandom().nextBytes(data);
342342
byte[] enc = Base64.encodeBase64(data);
343-
assertTrue("\"" + (new String(enc)) + "\" is Base64 data.", Base64.isBase64(enc));
343+
assertTrue("\"" + new String(enc) + "\" is Base64 data.", Base64.isBase64(enc));
344344
byte[] data2 = Base64.decodeBase64(enc);
345345
assertTrue(toString(data) + " equals " + toString(data2), Arrays.equals(data, data2));
346346
}

src/test/java/org/apache/commons/codec/language/SoundexTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public Soundex getSoundexEncoder() {
4949

5050
@Test
5151
public void testB650() throws EncoderException {
52-
this.checkEncodingVariations("B650", (new String[]{
52+
this.checkEncodingVariations("B650", new String[]{
5353
"BARHAM",
5454
"BARONE",
5555
"BARRON",
@@ -89,7 +89,7 @@ public void testB650() throws EncoderException {
8989
"BYRAM",
9090
"BYRNE",
9191
"BYRON",
92-
"BYRUM"}));
92+
"BYRUM"});
9393
}
9494

9595
@Test
@@ -189,15 +189,15 @@ public void testEncodeBatch4() {
189189

190190
@Test
191191
public void testEncodeIgnoreApostrophes() throws EncoderException {
192-
this.checkEncodingVariations("O165", (new String[]{
192+
this.checkEncodingVariations("O165", new String[]{
193193
"OBrien",
194194
"'OBrien",
195195
"O'Brien",
196196
"OB'rien",
197197
"OBr'ien",
198198
"OBri'en",
199199
"OBrie'n",
200-
"OBrien'"}));
200+
"OBrien'"});
201201
}
202202

203203
/**
@@ -207,7 +207,7 @@ public void testEncodeIgnoreApostrophes() throws EncoderException {
207207
*/
208208
@Test
209209
public void testEncodeIgnoreHyphens() throws EncoderException {
210-
this.checkEncodingVariations("K525", (new String[]{
210+
this.checkEncodingVariations("K525", new String[]{
211211
"KINGSMITH",
212212
"-KINGSMITH",
213213
"K-INGSMITH",
@@ -218,7 +218,7 @@ public void testEncodeIgnoreHyphens() throws EncoderException {
218218
"KINGSM-ITH",
219219
"KINGSMI-TH",
220220
"KINGSMIT-H",
221-
"KINGSMITH-"}));
221+
"KINGSMITH-"});
222222
}
223223

224224
@Test
@@ -259,7 +259,7 @@ public void testHWRuleEx3() throws EncoderException {
259259
Assert.assertEquals("S460", this.getSoundexEncoder().encode("Sgler"));
260260
Assert.assertEquals("S460", this.getSoundexEncoder().encode("Swhgler"));
261261
// Also S460:
262-
this.checkEncodingVariations("S460", (new String[]{
262+
this.checkEncodingVariations("S460", new String[]{
263263
"SAILOR",
264264
"SALYER",
265265
"SAYLOR",
@@ -275,7 +275,7 @@ public void testHWRuleEx3() throws EncoderException {
275275
"SHULER",
276276
"SILAR",
277277
"SILER",
278-
"SILLER"}));
278+
"SILLER"});
279279
}
280280

281281
/**
@@ -297,7 +297,7 @@ public void testMsSqlServer1() {
297297
*/
298298
@Test
299299
public void testMsSqlServer2() throws EncoderException {
300-
this.checkEncodingVariations("E625", (new String[]{"Erickson", "Erickson", "Erikson", "Ericson", "Ericksen", "Ericsen"}));
300+
this.checkEncodingVariations("E625", new String[]{"Erickson", "Erickson", "Erikson", "Ericson", "Ericksen", "Ericsen"});
301301
}
302302

303303
/**

src/test/java/org/apache/commons/codec/language/bm/RuleTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void describeTo(Description description) {
3636
}
3737

3838
public boolean matches(Object item) {
39-
return ((Integer) item) < 0;
39+
return (Integer) item < 0;
4040
}
4141
}
4242

0 commit comments

Comments
 (0)