Skip to content

Commit a175e52

Browse files
committed
Make code less twisty.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/codec/trunk@130371 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0e82d92 commit a175e52

1 file changed

Lines changed: 17 additions & 21 deletions

File tree

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

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* </ul>
3232
*
3333
* @author Apache Software Foundation
34-
* @version $Id: DoubleMetaphone.java,v 1.21 2004/05/24 00:25:22 ggregory Exp $
34+
* @version $Id: DoubleMetaphone.java,v 1.22 2004/05/24 00:28:10 ggregory Exp $
3535
*/
3636
public class DoubleMetaphone implements StringEncoder {
3737

@@ -806,28 +806,24 @@ private int handleZ(String value, DoubleMetaphoneResult result, int index,
806806
* Complex condition 0 for 'C'
807807
*/
808808
private boolean conditionC0(String value, int index) {
809-
if (contains(value, index, 4, "CHIA")) {
810-
return true;
811-
} else if (index <= 1) {
812-
return false;
813-
} else if (isVowel(charAt(value, index - 2))) {
814-
return false;
815-
} else if (!contains(value, index - 1, 3, "ACH")) {
816-
return false;
817-
} else {
818-
char c = charAt(value, index + 2);
819-
if ((c != 'I' && c != 'E') || contains(value, index - 2,
820-
6, "BACHER", "MACHER" )) {
821-
return true;
822-
} else {
823-
return false;
824-
}
825-
}
826-
}
809+
if (contains(value, index, 4, "CHIA")) {
810+
return true;
811+
} else if (index <= 1) {
812+
return false;
813+
} else if (isVowel(charAt(value, index - 2))) {
814+
return false;
815+
} else if (!contains(value, index - 1, 3, "ACH")) {
816+
return false;
817+
} else {
818+
char c = charAt(value, index + 2);
819+
return (c != 'I' && c != 'E')
820+
|| contains(value, index - 2, 6, "BACHER", "MACHER");
821+
}
822+
}
827823

828824
/**
829-
* Complex condition 0 for 'CH'
830-
*/
825+
* Complex condition 0 for 'CH'
826+
*/
831827
private boolean conditionCH0(String value, int index) {
832828
if (index != 0) {
833829
return false;

0 commit comments

Comments
 (0)