You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/05/19 12:04:59 UTC
(commons-codec) branch master updated (c529b5d9 -> 8be1e90f)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
from c529b5d9 Javadoc
new e37a4256 Remove dead comments
new 1ad76b4f Javadoc
new 1825f013 Format tweaks
new 8be1e90f Use an import instead of a FQCN
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/commons/codec/language/Caverphone1.java | 4 +-
.../apache/commons/codec/language/Caverphone2.java | 4 +-
.../commons/codec/language/DoubleMetaphone.java | 49 +++++++++-------------
.../apache/commons/codec/language/Metaphone.java | 6 ++-
.../commons/codec/language/SoundexUtils.java | 6 ++-
5 files changed, 34 insertions(+), 35 deletions(-)
(commons-codec) 01/04: Remove dead comments
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
commit e37a42561708adb6006f6222ece7654c68e63667
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Mon May 19 07:55:52 2025 -0400
Remove dead comments
---
.../java/org/apache/commons/codec/language/DoubleMetaphone.java | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
index 3ee8882e..237f29a3 100644
--- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
@@ -812,8 +812,6 @@ public class DoubleMetaphone implements StringEncoder {
return charAt(value, index + 1) == 'R' ? index + 2 : index + 1;
}
- //-- BEGIN CONDITIONS --//
-
/**
* Handles 'S' cases.
*/
@@ -968,8 +966,6 @@ public class DoubleMetaphone implements StringEncoder {
return index;
}
- //-- BEGIN HELPER FUNCTIONS --//
-
/**
* Handles 'Z' cases.
*/
@@ -1051,8 +1047,6 @@ public class DoubleMetaphone implements StringEncoder {
return VOWELS.indexOf(ch) != -1;
}
- //-- BEGIN INNER CLASSES --//
-
/**
* Sets the maxCodeLen.
* @param maxCodeLen The maxCodeLen to set
(commons-codec) 04/04: Use an import instead of a FQCN
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
commit 8be1e90f56caedeec5bbe6778bbe14f6c39c3502
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Mon May 19 08:04:52 2025 -0400
Use an import instead of a FQCN
---
src/main/java/org/apache/commons/codec/language/Caverphone1.java | 4 +++-
src/main/java/org/apache/commons/codec/language/Caverphone2.java | 4 +++-
.../java/org/apache/commons/codec/language/DoubleMetaphone.java | 4 +++-
src/main/java/org/apache/commons/codec/language/Metaphone.java | 6 ++++--
src/main/java/org/apache/commons/codec/language/SoundexUtils.java | 6 ++++--
5 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/language/Caverphone1.java b/src/main/java/org/apache/commons/codec/language/Caverphone1.java
index 72b98b6f..77495d70 100644
--- a/src/main/java/org/apache/commons/codec/language/Caverphone1.java
+++ b/src/main/java/org/apache/commons/codec/language/Caverphone1.java
@@ -17,6 +17,8 @@
package org.apache.commons.codec.language;
+import java.util.Locale;
+
/**
* Encodes a string into a Caverphone 1.0 value.
*
@@ -55,7 +57,7 @@ public class Caverphone1 extends AbstractCaverphone {
}
// 1. Convert to lowercase
- txt = txt.toLowerCase(java.util.Locale.ENGLISH);
+ txt = txt.toLowerCase(Locale.ENGLISH);
// 2. Remove anything not A-Z
txt = txt.replaceAll("[^a-z]", "");
diff --git a/src/main/java/org/apache/commons/codec/language/Caverphone2.java b/src/main/java/org/apache/commons/codec/language/Caverphone2.java
index b4fe12c1..bcd2e3a7 100644
--- a/src/main/java/org/apache/commons/codec/language/Caverphone2.java
+++ b/src/main/java/org/apache/commons/codec/language/Caverphone2.java
@@ -17,6 +17,8 @@
package org.apache.commons.codec.language;
+import java.util.Locale;
+
/**
* Encodes a string into a Caverphone 2.0 value.
*
@@ -55,7 +57,7 @@ public class Caverphone2 extends AbstractCaverphone {
}
// 1. Convert to lowercase
- txt = txt.toLowerCase(java.util.Locale.ENGLISH);
+ txt = txt.toLowerCase(Locale.ENGLISH);
// 2. Remove anything not A-Z
txt = txt.replaceAll("[^a-z]", "");
diff --git a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
index 7c87ddd6..150f8157 100644
--- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
@@ -17,6 +17,8 @@
package org.apache.commons.codec.language;
+import java.util.Locale;
+
import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.StringEncoder;
import org.apache.commons.codec.binary.StringUtils;
@@ -248,7 +250,7 @@ public class DoubleMetaphone implements StringEncoder {
if (input.isEmpty()) {
return null;
}
- return input.toUpperCase(java.util.Locale.ENGLISH);
+ return input.toUpperCase(Locale.ENGLISH);
}
/**
diff --git a/src/main/java/org/apache/commons/codec/language/Metaphone.java b/src/main/java/org/apache/commons/codec/language/Metaphone.java
index 34664e0d..6a964fe4 100644
--- a/src/main/java/org/apache/commons/codec/language/Metaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/Metaphone.java
@@ -17,6 +17,8 @@
package org.apache.commons.codec.language;
+import java.util.Locale;
+
import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.StringEncoder;
@@ -175,10 +177,10 @@ public class Metaphone implements StringEncoder {
}
// single character is itself
if (txtLength == 1) {
- return txt.toUpperCase(java.util.Locale.ENGLISH);
+ return txt.toUpperCase(Locale.ENGLISH);
}
- final char[] inwd = txt.toUpperCase(java.util.Locale.ENGLISH).toCharArray();
+ final char[] inwd = txt.toUpperCase(Locale.ENGLISH).toCharArray();
final StringBuilder local = new StringBuilder(40); // manipulate
final StringBuilder code = new StringBuilder(10); // output
diff --git a/src/main/java/org/apache/commons/codec/language/SoundexUtils.java b/src/main/java/org/apache/commons/codec/language/SoundexUtils.java
index c40b7cf2..2750ffe1 100644
--- a/src/main/java/org/apache/commons/codec/language/SoundexUtils.java
+++ b/src/main/java/org/apache/commons/codec/language/SoundexUtils.java
@@ -17,6 +17,8 @@
package org.apache.commons.codec.language;
+import java.util.Locale;
+
import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.StringEncoder;
@@ -50,9 +52,9 @@ final class SoundexUtils {
}
}
if (count == len) {
- return str.toUpperCase(java.util.Locale.ENGLISH);
+ return str.toUpperCase(Locale.ENGLISH);
}
- return new String(chars, 0, count).toUpperCase(java.util.Locale.ENGLISH);
+ return new String(chars, 0, count).toUpperCase(Locale.ENGLISH);
}
/**
(commons-codec) 03/04: Format tweaks
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
commit 1825f013fd3ece04ca6bb3abaa6c7c0de9e7bf69
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Mon May 19 08:01:13 2025 -0400
Format tweaks
---
.../apache/commons/codec/language/DoubleMetaphone.java | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
index 225663c0..7c87ddd6 100644
--- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
@@ -310,8 +310,6 @@ public class DoubleMetaphone implements StringEncoder {
contains(value, index - 1, 4, "ALLE");
}
- //-- BEGIN HANDLERS --//
-
/**
* Complex condition 0 for 'M'.
*/
@@ -626,8 +624,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* Handles 'G' cases.
*/
- private int handleG(final String value, final DoubleMetaphoneResult result, int index,
- final boolean slavoGermanic) {
+ private int handleG(final String value, final DoubleMetaphoneResult result, int index, final boolean slavoGermanic) {
if (charAt(value, index + 1) == 'H') {
index = handleGH(value, result, index);
} else if (charAt(value, index + 1) == 'N') {
@@ -733,8 +730,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* Handles 'J' cases.
*/
- private int handleJ(final String value, final DoubleMetaphoneResult result, int index,
- final boolean slavoGermanic) {
+ private int handleJ(final String value, final DoubleMetaphoneResult result, int index, final boolean slavoGermanic) {
if (contains(value, index, 4, "JOSE") || contains(value, 0, 4, "SAN ")) {
//-- obvious Spanish, "Jose", "San Jacinto" --//
if (index == 0 && charAt(value, index + 4) == ' ' ||
@@ -801,8 +797,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* Handles 'R' cases.
*/
- private int handleR(final String value, final DoubleMetaphoneResult result, final int index,
- final boolean slavoGermanic) {
+ private int handleR(final String value, final DoubleMetaphoneResult result, final int index, final boolean slavoGermanic) {
if (index == value.length() - 1 && !slavoGermanic &&
contains(value, index - 2, 2, "IE") &&
!contains(value, index - 4, 2, "ME", "MA")) {
@@ -816,8 +811,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* Handles 'S' cases.
*/
- private int handleS(final String value, final DoubleMetaphoneResult result, int index,
- final boolean slavoGermanic) {
+ private int handleS(final String value, final DoubleMetaphoneResult result, int index, final boolean slavoGermanic) {
if (contains(value, index - 1, 3, "ISL", "YSL")) {
//-- special cases "island", "isle", "carlisle", "carlysle" --//
index++;
@@ -970,8 +964,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* Handles 'Z' cases.
*/
- private int handleZ(final String value, final DoubleMetaphoneResult result, int index,
- final boolean slavoGermanic) {
+ private int handleZ(final String value, final DoubleMetaphoneResult result, int index, final boolean slavoGermanic) {
if (charAt(value, index + 1) == 'H') {
//-- Chinese pinyin for example "zhao" or Angelina "Zhang" --//
result.append('J');
(commons-codec) 02/04: Javadoc
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
commit 1ad76b4f9b2a0055e3cfb5e5a544abc48eae1557
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Mon May 19 07:58:14 2025 -0400
Javadoc
---
.../commons/codec/language/DoubleMetaphone.java | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
index 237f29a3..225663c0 100644
--- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
@@ -324,7 +324,7 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Encode a value with Double Metaphone.
+ * Encodes a value with Double Metaphone.
*
* @param value String to encode
* @return an encoded string
@@ -334,7 +334,7 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Encode a value with Double Metaphone, optionally using the alternate encoding.
+ * Encodes a value with Double Metaphone, optionally using the alternate encoding.
*
* @param value String to encode
* @param alternate use alternate encode
@@ -448,7 +448,7 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Encode the value using DoubleMetaphone. It will only work if
+ * Encodes the value using DoubleMetaphone. It will only work if
* {@code obj} is a {@code String} (like {@code Metaphone}).
*
* @param obj Object to encode (should be of type String)
@@ -464,7 +464,7 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Encode the value using DoubleMetaphone.
+ * Encodes the value using DoubleMetaphone.
*
* @param value String to encode
* @return An encoded String
@@ -475,7 +475,8 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Returns the maxCodeLen.
+ * Gets the maxCodeLen.
+ *
* @return int
*/
public int getMaxCodeLen() {
@@ -988,7 +989,7 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Check if the Double Metaphone values of two {@code String} values
+ * Tests whether the Double Metaphone values of two {@code String} values
* are equal.
*
* @param value1 The left-hand side of the encoded {@link String#equals(Object)}.
@@ -1002,7 +1003,7 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Check if the Double Metaphone values of two {@code String} values
+ * Tests whether the Double Metaphone values of two {@code String} values
* are equal, optionally using the alternate value.
*
* @param value1 The left-hand side of the encoded {@link String#equals(Object)}.
@@ -1016,7 +1017,7 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Determines whether or not the value starts with a silent letter. It will
+ * Tests whether or not the value starts with a silent letter. It will
* return {@code true} if the value starts with any of 'GN', 'KN',
* 'PN', 'WR' or 'PS'.
*/
@@ -1032,7 +1033,7 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Determines whether or not a value is of slavo-germanic origin. A value is
+ * Tests whether or not a value is of slavo-germanic origin. A value is
* of slavo-germanic origin if it contains any of 'W', 'K', 'CZ', or 'WITZ'.
*/
private boolean isSlavoGermanic(final String value) {
@@ -1041,7 +1042,7 @@ public class DoubleMetaphone implements StringEncoder {
}
/**
- * Determines whether or not a character is a vowel or not
+ * Tests whether or not a character is a vowel or not
*/
private boolean isVowel(final char ch) {
return VOWELS.indexOf(ch) != -1;
@@ -1049,6 +1050,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* Sets the maxCodeLen.
+ *
* @param maxCodeLen The maxCodeLen to set
*/
public void setMaxCodeLen(final int maxCodeLen) {