ggregory 2004/05/23 21:55:33
Modified: codec/src/java/org/apache/commons/codec/language
DoubleMetaphone.java
Log:
Make code less twisty.
Revision Changes Path
1.23 +26 -30
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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- DoubleMetaphone.java 24 May 2004 00:28:10 -0000 1.22
+++ DoubleMetaphone.java 24 May 2004 04:55:33 -0000 1.23
@@ -869,21 +869,20 @@
* Complex condition 0 for 'M'
*/
private boolean conditionM0(String value, int index) {
- if (charAt(value, index + 1) == 'M') {
- return true;
- } else {
- return contains(value, index - 1, 3, "UMB") &&
- ((index + 1) == value.length() - 1 ||
- contains(value, index + 2, 2, "ER"));
- }
- }
+ if (charAt(value, index + 1) == 'M') {
+ return true;
+ }
+ return contains(value, index - 1, 3, "UMB")
+ && ((index + 1) == value.length() - 1 ||
contains(value,
+ index + 2, 2, "ER"));
+ }
//-- BEGIN HELPER FUNCTIONS --//
/**
- * Determines whether or not a value is of slavo-germanic orgin. A value is
- * of slavo-germanic origin if it contians any of 'W', 'K', 'CZ', or 'WITZ'.
- */
+ * Determines whether or not a value is of slavo-germanic orgin. A value is
+ * of slavo-germanic origin if it contians any of 'W', 'K', 'CZ', or 'WITZ'.
+ */
private boolean isSlavoGermanic(String value) {
return value.indexOf('W') > -1 || value.indexOf('K') > -1 ||
value.indexOf("CZ") > -1 || value.indexOf("WITZ") > -1;
@@ -916,29 +915,26 @@
* Cleans the input
*/
private String cleanInput(String input) {
- if (input == null) {
- return null;
- } else {
- input = input.trim();
- if (input.length() == 0) {
- return null;
- } else {
- return input.toUpperCase();
- }
- }
- }
+ if (input == null) {
+ return null;
+ }
+ input = input.trim();
+ if (input.length() == 0) {
+ return null;
+ }
+ return input.toUpperCase();
+ }
/**
- * Gets the character at index <code>index</code> if available, otherwise it
- * returns <code>Character.MIN_VALUE</code> so that there is some sort of a
- * default
- */
+ * Gets the character at index <code>index</code> if available, otherwise
+ * it returns <code>Character.MIN_VALUE</code> so that there is some sort
+ * of a default
+ */
protected char charAt(String value, int index) {
if (index < 0 || index >= value.length()) {
return Character.MIN_VALUE;
- } else {
- return value.charAt(index);
- }
+ }
+ return value.charAt(index);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]