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/07/19 16:33:18 UTC
(commons-codec) branch master updated (4c0174fe -> 8cbdc117)
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 4c0174fe Javadoc
new f5db5a2d Javadoc
new 733e35e0 Add Javadoc reference to C++ source
new 8cbdc117 Better comment, fix spelling, Javadoc
The 3 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:
.../commons/codec/language/DoubleMetaphone.java | 37 +++++++++++-----------
.../apache/commons/codec/language/Metaphone.java | 24 +++++++-------
.../commons/codec/language/MetaphoneTest.java | 4 +--
3 files changed, 33 insertions(+), 32 deletions(-)
(commons-codec) 02/03: Add Javadoc reference to C++ source
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 733e35e0cab3f8188d7faebd3248d916d0a82db8
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 19 12:23:46 2025 -0400
Add Javadoc reference to C++ source
---
src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java | 1 +
1 file changed, 1 insertion(+)
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 2579ee41..23c2b9d7 100644
--- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
@@ -35,6 +35,7 @@ import org.apache.commons.codec.binary.StringUtils;
*
* @see <a href="https://drdobbs.com/the-double-metaphone-search-algorithm/184401251?pgno=2">Dr. Dobbs Original Article</a>
* @see <a href="https://en.wikipedia.org/wiki/Metaphone">Wikipedia Metaphone</a>
+ * @see <a href="http://aspell.net/metaphone/dmetaph.cpp">Double Metaphone C++ source by Lawrence Philips</a>
*/
public class DoubleMetaphone implements StringEncoder {
(commons-codec) 03/03: Better comment, fix spelling, 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 8cbdc117d69aaae78daa7505aaa9b2e40692a67c
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 19 12:29:17 2025 -0400
Better comment, fix spelling, Javadoc
Remove redundant keyword
---
.../commons/codec/language/DoubleMetaphone.java | 34 +++++++++++-----------
1 file changed, 17 insertions(+), 17 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 23c2b9d7..2ec17c59 100644
--- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
@@ -105,8 +105,8 @@ public class DoubleMetaphone implements StringEncoder {
* @param value The value to append.
*/
public void appendAlternate(final char value) {
- if (this.alternate.length() < this.maxLength) {
- this.alternate.append(value);
+ if (alternate.length() < maxLength) {
+ alternate.append(value);
}
}
@@ -116,11 +116,11 @@ public class DoubleMetaphone implements StringEncoder {
* @param value The value to append.
*/
public void appendAlternate(final String value) {
- final int addChars = this.maxLength - this.alternate.length();
+ final int addChars = maxLength - alternate.length();
if (value.length() <= addChars) {
- this.alternate.append(value);
+ alternate.append(value);
} else {
- this.alternate.append(value, 0, addChars);
+ alternate.append(value, 0, addChars);
}
}
@@ -130,8 +130,8 @@ public class DoubleMetaphone implements StringEncoder {
* @param value The value to append.
*/
public void appendPrimary(final char value) {
- if (this.primary.length() < this.maxLength) {
- this.primary.append(value);
+ if (primary.length() < maxLength) {
+ primary.append(value);
}
}
@@ -141,11 +141,11 @@ public class DoubleMetaphone implements StringEncoder {
* @param value The value to append.
*/
public void appendPrimary(final String value) {
- final int addChars = this.maxLength - this.primary.length();
+ final int addChars = maxLength - primary.length();
if (value.length() <= addChars) {
- this.primary.append(value);
+ primary.append(value);
} else {
- this.primary.append(value, 0, addChars);
+ primary.append(value, 0, addChars);
}
}
@@ -155,7 +155,7 @@ public class DoubleMetaphone implements StringEncoder {
* @return the alternate string.
*/
public String getAlternate() {
- return this.alternate.toString();
+ return alternate.toString();
}
/**
@@ -164,7 +164,7 @@ public class DoubleMetaphone implements StringEncoder {
* @return the primary string.
*/
public String getPrimary() {
- return this.primary.toString();
+ return primary.toString();
}
/**
@@ -173,7 +173,7 @@ public class DoubleMetaphone implements StringEncoder {
* @return whether this result is complete.
*/
public boolean isComplete() {
- return this.primary.length() >= this.maxLength && this.alternate.length() >= this.maxLength;
+ return primary.length() >= maxLength && alternate.length() >= maxLength;
}
}
@@ -367,7 +367,7 @@ public class DoubleMetaphone implements StringEncoder {
index = charAt(value, index + 1) == 'B' ? index + 2 : index + 1;
break;
case '\u00C7':
- // A C with a Cedilla
+ // C with a Cedilla
result.append('S');
index++;
break;
@@ -406,7 +406,7 @@ public class DoubleMetaphone implements StringEncoder {
index = charAt(value, index + 1) == 'N' ? index + 2 : index + 1;
break;
case '\u00D1':
- // N with a tilde (spanish ene)
+ // N with a tilde (Spanish ene)
result.append('N');
index++;
break;
@@ -481,7 +481,7 @@ public class DoubleMetaphone implements StringEncoder {
* @return the maxCodeLen.
*/
public int getMaxCodeLen() {
- return this.maxCodeLen;
+ return maxCodeLen;
}
/**
@@ -1030,7 +1030,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* 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'.
+ * of Slavo-Germanic origin if it contains any of 'W', 'K', 'CZ', or 'WITZ'.
*/
private boolean isSlavoGermanic(final String value) {
return value.indexOf('W') > -1 || value.indexOf('K') > -1 ||
(commons-codec) 01/03: 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 f5db5a2d11ba51190bdf7235a936940131713c7a
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 19 12:23:28 2025 -0400
Javadoc
---
.../commons/codec/language/DoubleMetaphone.java | 2 +-
.../apache/commons/codec/language/Metaphone.java | 24 +++++++++++-----------
.../commons/codec/language/MetaphoneTest.java | 4 ++--
3 files changed, 15 insertions(+), 15 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 ee28d99d..2579ee41 100644
--- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
@@ -24,7 +24,7 @@ import org.apache.commons.codec.StringEncoder;
import org.apache.commons.codec.binary.StringUtils;
/**
- * Encodes a string into a double metaphone value. This Implementation is based on the algorithm by <CITE>Lawrence
+ * Encodes a string into a Double Metaphone value. This Implementation is based on the algorithm by <CITE>Lawrence
* Philips</CITE>.
* <p>
* This class is conditionally thread-safe. The instance field for the maximum code length is mutable
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 8016ac34..5dc0aac6 100644
--- a/src/main/java/org/apache/commons/codec/language/Metaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/Metaphone.java
@@ -57,22 +57,22 @@ import org.apache.commons.codec.StringEncoder;
public class Metaphone implements StringEncoder {
/**
- * Five values in the English language
+ * Five values in the English language.
*/
private static final String VOWELS = "AEIOU";
/**
- * Variable used in Metaphone algorithm
+ * Variable used in Metaphone algorithm.
*/
private static final String FRONTV = "EIY";
/**
- * Variable used in Metaphone algorithm
+ * Variable used in Metaphone algorithm.
*/
private static final String VARSON = "CSPTG";
/**
- * The max code length for metaphone is 4
+ * The max code length for Metaphone is 4.
*/
private int maxCodeLen = 4;
@@ -84,11 +84,11 @@ public class Metaphone implements StringEncoder {
}
/**
- * Encodes an Object using the metaphone algorithm. This method is provided in order to satisfy the requirements of the Encoder interface, and will throw an
+ * Encodes an Object using the Metaphone algorithm. This method is provided in order to satisfy the requirements of the Encoder interface, and will throw an
* EncoderException if the supplied object is not of type {@link String}.
*
* @param obj Object to encode.
- * @return An object (or type {@link String}) containing the metaphone code which corresponds to the String supplied.
+ * @return An object (or type {@link String}) containing the Metaphone code which corresponds to the String supplied.
* @throws EncoderException if the parameter supplied is not of type {@link String}.
*/
@Override
@@ -103,7 +103,7 @@ public class Metaphone implements StringEncoder {
* Encodes a String using the Metaphone algorithm.
*
* @param str String object to encode
- * @return The metaphone code corresponding to the String supplied
+ * @return The Metaphone code corresponding to the String supplied
*/
@Override
public String encode(final String str) {
@@ -124,11 +124,11 @@ public class Metaphone implements StringEncoder {
}
/**
- * Tests is the metaphones of two strings are identical.
+ * Tests is the Metaphones of two strings are identical.
*
* @param str1 First of two strings to compare.
* @param str2 Second of two strings to compare.
- * @return {@code true} if the metaphones of these strings are identical, {@code false} otherwise.
+ * @return {@code true} if the Metaphones of these strings are identical, {@code false} otherwise.
*/
public boolean isMetaphoneEqual(final String str1, final String str2) {
return metaphone(str1).equals(metaphone(str2));
@@ -155,14 +155,14 @@ public class Metaphone implements StringEncoder {
}
/**
- * Find the metaphone value of a String. This is similar to the
+ * Find the Metaphone value of a String. This is similar to the
* Soundex algorithm, but better at finding similar sounding words.
* All input is converted to upper case.
* Limitations: Input format is expected to be a single ASCII word
* with only characters in the A - Z range, no punctuation or numbers.
*
- * @param txt String to find the metaphone code for.
- * @return A metaphone code corresponding to the String supplied.
+ * @param txt String to find the Metaphone code for.
+ * @return A Metaphone code corresponding to the String supplied.
*/
public String metaphone(final String txt) {
boolean hard = false;
diff --git a/src/test/java/org/apache/commons/codec/language/MetaphoneTest.java b/src/test/java/org/apache/commons/codec/language/MetaphoneTest.java
index b999f085..26dd0cc1 100644
--- a/src/test/java/org/apache/commons/codec/language/MetaphoneTest.java
+++ b/src/test/java/org/apache/commons/codec/language/MetaphoneTest.java
@@ -287,11 +287,11 @@ class MetaphoneTest extends AbstractStringEncoderTest<Metaphone> {
}
/**
- * Tests (CODEC-57) Metaphone.metaphone(String) returns an empty string when passed the word "why"
+ * Tests (CODEC-57) Metaphone.Metaphone(String) returns an empty string when passed the word "why"
*/
@Test
void testWhy() {
- // PHP returns "H". The original metaphone returns an empty string.
+ // PHP returns "H". The original Metaphone returns an empty string.
assertEquals("", getStringEncoder().metaphone("WHY"));
}