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 4c0174fe22187b5e406571f61c802ea36967f925 Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jul 19 09:16:29 2025 -0400 Javadoc --- .../commons/codec/language/AbstractCaverphone.java | 6 +- .../apache/commons/codec/language/Caverphone.java | 14 ++--- .../apache/commons/codec/language/Caverphone1.java | 4 +- .../apache/commons/codec/language/Caverphone2.java | 4 +- .../commons/codec/language/ColognePhonetic.java | 6 +- .../codec/language/DaitchMokotoffSoundex.java | 32 +++++------ .../commons/codec/language/DoubleMetaphone.java | 28 +++++----- .../codec/language/MatchRatingApproachEncoder.java | 38 ++++++------- .../apache/commons/codec/language/Metaphone.java | 25 ++++----- .../org/apache/commons/codec/language/Nysiis.java | 43 ++++++-------- .../commons/codec/language/RefinedSoundex.java | 28 +++++----- .../org/apache/commons/codec/language/Soundex.java | 65 +++++++++------------- .../commons/codec/language/SoundexUtils.java | 4 +- 13 files changed, 137 insertions(+), 160 deletions(-) diff --git a/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java b/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java index 1d2a3bfb..f04c1b01 100644 --- a/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java +++ b/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java @@ -45,7 +45,7 @@ public abstract class AbstractCaverphone implements StringEncoder { * the Encoder interface, and will throw an EncoderException if the supplied object is not of type {@link String}. * * @param source - * Object to encode + * Object to encode. * @return An object (or type {@link String}) containing the Caverphone code which corresponds to the String * supplied. * @throws EncoderException @@ -65,9 +65,9 @@ public abstract class AbstractCaverphone implements StringEncoder { * This method might be promoted to a new AbstractStringEncoder superclass. * * @param str1 - * First of two strings to compare + * First of two strings to compare. * @param str2 - * Second of two strings to compare + * Second of two strings to compare. * @return {@code true} if the encodings of these strings are identical, {@code false} otherwise. * @throws EncoderException * thrown if there is an error condition during the encoding process. diff --git a/src/main/java/org/apache/commons/codec/language/Caverphone.java b/src/main/java/org/apache/commons/codec/language/Caverphone.java index b9459dc6..6c093df4 100644 --- a/src/main/java/org/apache/commons/codec/language/Caverphone.java +++ b/src/main/java/org/apache/commons/codec/language/Caverphone.java @@ -50,8 +50,8 @@ public class Caverphone implements StringEncoder { * Encodes the given String into a Caverphone value. * * @param source - * String the source string - * @return A Caverphone code for the given String + * String the source string. + * @return A Caverphone code for the given String. */ public String caverphone(final String source) { return this.encoder.encode(source); @@ -62,7 +62,7 @@ public class Caverphone implements StringEncoder { * the Encoder interface, and will throw an EncoderException if the supplied object is not of type {@link String}. * * @param obj - * Object to encode + * Object to encode. * @return An object (or type {@link String}) containing the Caverphone code which corresponds to the String * supplied. * @throws EncoderException @@ -80,8 +80,8 @@ public class Caverphone implements StringEncoder { * Encodes a String using the Caverphone algorithm. * * @param str - * String object to encode - * @return The Caverphone code corresponding to the String supplied + * String object to encode. + * @return The Caverphone code corresponding to the String supplied. */ @Override public String encode(final String str) { @@ -92,9 +92,9 @@ public class Caverphone implements StringEncoder { * Tests if the Caverphones of two strings are identical. * * @param str1 - * First of two strings to compare + * First of two strings to compare. * @param str2 - * Second of two strings to compare + * Second of two strings to compare. * @return {@code true} if the Caverphones of these strings are identical, {@code false} otherwise. */ public boolean isCaverphoneEqual(final String str1, final String str2) { 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 77495d70..decd4a52 100644 --- a/src/main/java/org/apache/commons/codec/language/Caverphone1.java +++ b/src/main/java/org/apache/commons/codec/language/Caverphone1.java @@ -46,8 +46,8 @@ public class Caverphone1 extends AbstractCaverphone { * Encodes the given String into a Caverphone value. * * @param source - * String the source string - * @return A Caverphone code for the given String + * String the source string. + * @return A Caverphone code for the given String. */ @Override public String encode(final String source) { 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 bcd2e3a7..e58c4ddf 100644 --- a/src/main/java/org/apache/commons/codec/language/Caverphone2.java +++ b/src/main/java/org/apache/commons/codec/language/Caverphone2.java @@ -46,8 +46,8 @@ public class Caverphone2 extends AbstractCaverphone { * Encodes the given String into a Caverphone 2.0 value. * * @param source - * String the source string - * @return A Caverphone code for the given String + * String the source string. + * @return A Caverphone code for the given String. */ @Override public String encode(final String source) { diff --git a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java b/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java index 6534625b..aab2420f 100644 --- a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java +++ b/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java @@ -320,8 +320,8 @@ public class ColognePhonetic implements StringEncoder { * In contrast to the initial description of the algorithm, this implementation does the encoding in one pass. * </p> * - * @param text The source text to encode - * @return the corresponding encoding according to the <em>Kölner Phonetik</em> algorithm + * @param text The source text to encode. + * @return the corresponding encoding according to the <em>Kölner Phonetik</em> algorithm. */ public String colognePhonetic(final String text) { if (text == null) { @@ -426,7 +426,7 @@ public class ColognePhonetic implements StringEncoder { * @param text1 source text to encode before testing for equality. * @param text2 source text to encode before testing for equality. * @return {@code true} if the encoding the first string equals the encoding of the second string, {@code false} - * otherwise + * otherwise. */ public boolean isEncodeEqual(final String text1, final String text2) { return colognePhonetic(text1).equals(colognePhonetic(text2)); diff --git a/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java b/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java index d00d2474..47e5e9c3 100644 --- a/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java +++ b/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java @@ -123,9 +123,9 @@ public class DaitchMokotoffSoundex implements StringEncoder { * Process the next replacement to be added to this branch. * * @param replacement - * the next replacement to append + * the next replacement to append. * @param forceAppend - * indicates if the default processing shall be overridden + * indicates if the default processing shall be overridden. */ private void processNextReplacement(final String replacement, final boolean forceAppend) { final boolean append = lastReplacement == null || !lastReplacement.endsWith(replacement) || forceAppend; @@ -341,8 +341,8 @@ public class DaitchMokotoffSoundex implements StringEncoder { * </p> * * @param input - * the input string to clean up - * @return a cleaned up string + * the input string to clean up. + * @return a cleaned up string. */ private String cleanup(final String input) { final StringBuilder sb = new StringBuilder(); @@ -369,13 +369,13 @@ public class DaitchMokotoffSoundex implements StringEncoder { * * @see #soundex(String) * @param obj - * Object to encode + * Object to encode. * @return An object (of type {@link String}) containing the DM Soundex code, which corresponds to the String * supplied. * @throws EncoderException - * if the parameter supplied is not of type {@link String} + * if the parameter supplied is not of type {@link String}. * @throws IllegalArgumentException - * if a character is not mapped + * if a character is not mapped. */ @Override public Object encode(final Object obj) throws EncoderException { @@ -391,10 +391,10 @@ public class DaitchMokotoffSoundex implements StringEncoder { * * @see #soundex(String) * @param source - * A String object to encode - * @return A DM Soundex code corresponding to the String supplied + * A String object to encode. + * @return A DM Soundex code corresponding to the String supplied. * @throws IllegalArgumentException - * if a character is not mapped + * if a character is not mapped. */ @Override public String encode(final String source) { @@ -422,10 +422,10 @@ public class DaitchMokotoffSoundex implements StringEncoder { * </p> * * @param source - * A String object to encode - * @return A string containing a set of DM Soundex codes corresponding to the String supplied + * A String object to encode. + * @return A string containing a set of DM Soundex codes corresponding to the String supplied. * @throws IllegalArgumentException - * if a character is not mapped + * if a character is not mapped. */ public String soundex(final String source) { return String.join("|", soundex(source, true)); @@ -435,11 +435,11 @@ public class DaitchMokotoffSoundex implements StringEncoder { * Perform the actual DM Soundex algorithm on the input string. * * @param source - * A String object to encode + * A String object to encode. * @param branching - * If branching shall be performed + * If branching shall be performed. * @return A string array containing all DM Soundex codes corresponding to the String supplied depending on the - * selected branching mode + * selected branching mode. */ private String[] soundex(final String source, final boolean branching) { if (source == null) { 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 150f8157..ee28d99d 100644 --- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java +++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java @@ -214,7 +214,7 @@ public class DoubleMetaphone implements StringEncoder { } /** - * Maximum length of an encoding, default is 4 + * Maximum length of an encoding, default is 4. */ private int maxCodeLen = 4; @@ -326,8 +326,8 @@ public class DoubleMetaphone implements StringEncoder { /** * Encodes a value with Double Metaphone. * - * @param value String to encode - * @return an encoded string + * @param value String to encode. + * @return an encoded string. */ public String doubleMetaphone(final String value) { return doubleMetaphone(value, false); @@ -336,9 +336,9 @@ public class DoubleMetaphone implements StringEncoder { /** * Encodes a value with Double Metaphone, optionally using the alternate encoding. * - * @param value String to encode - * @param alternate use alternate encode - * @return an encoded string + * @param value String to encode. + * @param alternate use alternate encode. + * @return an encoded string. */ public String doubleMetaphone(String value, final boolean alternate) { value = cleanInput(value); @@ -451,9 +451,9 @@ public class DoubleMetaphone implements StringEncoder { * 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) - * @return An encoded Object (will be of type String) - * @throws EncoderException encode parameter is not of type String + * @param obj Object to encode (should be of type String). + * @return An encoded Object (will be of type String). + * @throws EncoderException encode parameter is not of type String. */ @Override public Object encode(final Object obj) throws EncoderException { @@ -466,8 +466,8 @@ public class DoubleMetaphone implements StringEncoder { /** * Encodes the value using DoubleMetaphone. * - * @param value String to encode - * @return An encoded String + * @param value String to encode. + * @return An encoded String. */ @Override public String encode(final String value) { @@ -477,7 +477,7 @@ public class DoubleMetaphone implements StringEncoder { /** * Gets the maxCodeLen. * - * @return int + * @return the maxCodeLen. */ public int getMaxCodeLen() { return this.maxCodeLen; @@ -1037,7 +1037,7 @@ public class DoubleMetaphone implements StringEncoder { } /** - * Tests 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; @@ -1046,7 +1046,7 @@ public class DoubleMetaphone implements StringEncoder { /** * Sets the maxCodeLen. * - * @param maxCodeLen The maxCodeLen to set + * @param maxCodeLen The maxCodeLen to set. */ public void setMaxCodeLen(final int maxCodeLen) { this.maxCodeLen = maxCodeLen; diff --git a/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java b/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java index f263122f..4f9863e4 100644 --- a/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java +++ b/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java @@ -79,8 +79,8 @@ public class MatchRatingApproachEncoder implements StringEncoder { * </p> * * @param name - * The name to be cleaned - * @return The cleaned name + * The name to be cleaned. + * @return The cleaned name. */ String cleanName(final String name) { String upperName = name.toUpperCase(Locale.ENGLISH); @@ -99,11 +99,11 @@ public class MatchRatingApproachEncoder implements StringEncoder { * Encoder interface Throws an EncoderException if input object is not of type {@link String}. * * @param object - * Object to encode + * Object to encode. * @return An object (or type {@link String}) containing the Match Rating Approach code which corresponds to the * String supplied. * @throws EncoderException - * if the parameter supplied is not of type {@link String} + * if the parameter supplied is not of type {@link String}. */ @Override public final Object encode(final Object object) throws EncoderException { @@ -118,8 +118,8 @@ public class MatchRatingApproachEncoder implements StringEncoder { * Encodes a String using the Match Rating Approach (MRA) algorithm. * * @param name - * String object to encode - * @return The MRA code corresponding to the String supplied + * String object to encode. + * @return The MRA code corresponding to the String supplied. */ @Override public final String encode(String name) { @@ -160,7 +160,7 @@ public class MatchRatingApproachEncoder implements StringEncoder { * </p> * * @param name - * The string to get the substrings from + * The string to get the substrings from. * @return Annexed first and last 3 letters of input word. */ String getFirst3Last3(final String name) { @@ -184,8 +184,8 @@ public class MatchRatingApproachEncoder implements StringEncoder { * </p> * * @param sumLength - * The length of 2 strings sent down - * @return The min rating value + * The length of 2 strings sent down. + * @return The min rating value. */ int getMinRating(final int sumLength) { int minRating = 0; @@ -210,9 +210,9 @@ public class MatchRatingApproachEncoder implements StringEncoder { * strings are cleaned in the same way as {@link #encode(String)}. * * @param name1 - * First of the 2 strings (names) to compare + * First of the 2 strings (names) to compare. * @param name2 - * Second of the 2 names to compare + * Second of the 2 names to compare. * @return {@code true} if the encodings are identical {@code false} otherwise. */ public boolean isEncodeEquals(String name1, String name2) { @@ -295,9 +295,9 @@ public class MatchRatingApproachEncoder implements StringEncoder { * Consider this method private, it is package protected for unit testing only. * </p> * - * @param name1 - * name2 - * @return the length as above + * @param name1 first name. + * @param name1 second name. + * @return the length as above. */ int leftToRightThenRightToLeftProcessing(final String name1, final String name2) { final char[] name1Char = name1.toCharArray(); @@ -353,7 +353,7 @@ public class MatchRatingApproachEncoder implements StringEncoder { * * @param accentedWord * The word that may have accents in it. - * @return De-accented word + * @return De-accented word. */ String removeAccents(final String accentedWord) { if (accentedWord == null) { @@ -385,8 +385,8 @@ public class MatchRatingApproachEncoder implements StringEncoder { * </p> * * @param name - * String to have double consonants removed - * @return Single consonant word + * String to have double consonants removed. + * @return Single consonant word. */ String removeDoubleConsonants(final String name) { String replacedName = name.toUpperCase(Locale.ENGLISH); @@ -408,8 +408,8 @@ public class MatchRatingApproachEncoder implements StringEncoder { * </p> * * @param name - * The name to have vowels removed - * @return De-voweled word + * The name to have vowels removed. + * @return De-voweled word. */ String removeVowels(String name) { // Extract first letter 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 1dedf674..8016ac34 100644 --- a/src/main/java/org/apache/commons/codec/language/Metaphone.java +++ b/src/main/java/org/apache/commons/codec/language/Metaphone.java @@ -84,16 +84,12 @@ 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 EncoderException if the - * supplied object is not of type {@link String}. + * 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. - * @throws EncoderException if the parameter supplied 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. + * @throws EncoderException if the parameter supplied is not of type {@link String}. */ @Override public Object encode(final Object obj) throws EncoderException { @@ -130,10 +126,9 @@ public class Metaphone implements StringEncoder { /** * 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. + * @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. */ public boolean isMetaphoneEqual(final String str1, final String str2) { return metaphone(str1).equals(metaphone(str2)); @@ -166,8 +161,8 @@ public class Metaphone implements StringEncoder { * 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/main/java/org/apache/commons/codec/language/Nysiis.java b/src/main/java/org/apache/commons/codec/language/Nysiis.java index 944e89f9..033b571c 100644 --- a/src/main/java/org/apache/commons/codec/language/Nysiis.java +++ b/src/main/java/org/apache/commons/codec/language/Nysiis.java @@ -96,8 +96,8 @@ public class Nysiis implements StringEncoder { * Tests if the given character is a vowel. * * @param c - * the character to test - * @return {@code true} if the character is a vowel, {@code false} otherwise + * the character to test. + * @return {@code true} if the character is a vowel, {@code false} otherwise. */ private static boolean isVowel(final char c) { return c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U'; @@ -108,14 +108,14 @@ public class Nysiis implements StringEncoder { * a time: [i-1, i, i+1, i+2]. * * @param prev - * the previous character + * the previous character. * @param curr - * the current character + * the current character. * @param next - * the next character + * the next character. * @param aNext - * the after next character - * @return a transcoded array of characters, starting from the current position + * the after next character. + * @return a transcoded array of characters, starting from the current position. */ private static char[] transcodeRemaining(final char prev, final char curr, final char next, final char aNext) { // 1. EV -> AF @@ -190,24 +190,20 @@ public class Nysiis implements StringEncoder { * </ul> * * @param strict - * the strict mode + * the strict mode. */ public Nysiis(final boolean strict) { this.strict = strict; } /** - * Encodes an Object using the NYSIIS algorithm. This method is provided in order to satisfy the requirements of the - * Encoder interface, and will throw an {@link EncoderException} if the supplied object is not of type - * {@link String}. + * Encodes an Object using the NYSIIS algorithm. This method is provided in order to satisfy the requirements of the Encoder interface, and will throw an + * {@link EncoderException} if the supplied object is not of type {@link String}. * - * @param obj - * Object to encode + * @param obj Object to encode. * @return An object (or a {@link String}) containing the NYSIIS code which corresponds to the given String. - * @throws EncoderException - * if the parameter supplied is not of a {@link String} - * @throws IllegalArgumentException - * if a character is not mapped + * @throws EncoderException if the parameter supplied is not of a {@link String}. + * @throws IllegalArgumentException if a character is not mapped. */ @Override public Object encode(final Object obj) throws EncoderException { @@ -220,11 +216,9 @@ public class Nysiis implements StringEncoder { /** * Encodes a String using the NYSIIS algorithm. * - * @param str - * A String object to encode - * @return A Nysiis code corresponding to the String supplied - * @throws IllegalArgumentException - * if a character is not mapped + * @param str A String object to encode. + * @return A Nysiis code corresponding to the String supplied. + * @throws IllegalArgumentException if a character is not mapped. */ @Override public String encode(final String str) { @@ -243,9 +237,8 @@ public class Nysiis implements StringEncoder { /** * Retrieves the NYSIIS code for a given String object. * - * @param str - * String to encode using the NYSIIS algorithm - * @return A NYSIIS code for the String supplied + * @param str String to encode using the NYSIIS algorithm. + * @return A NYSIIS code for the String supplied. */ public String nysiis(String str) { if (str == null) { diff --git a/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java b/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java index 39bd9e37..814ab40b 100644 --- a/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java +++ b/src/main/java/org/apache/commons/codec/language/RefinedSoundex.java @@ -25,7 +25,9 @@ import org.apache.commons.codec.StringEncoder; * optimized for spell checking words. Soundex method originally developed by * <CITE>Margaret Odell</CITE> and <CITE>Robert Russell</CITE>. * - * <p>This class is immutable and thread-safe.</p> + * <p> + * This class is immutable and thread-safe. + * </p> */ public class RefinedSoundex implements StringEncoder { @@ -64,7 +66,7 @@ public class RefinedSoundex implements StringEncoder { /** * Every letter of the alphabet is "mapped" to a numerical value. This char * array holds the values to which each letter is mapped. This - * implementation contains a default map for US_ENGLISH + * implementation contains a default map for US_ENGLISH. */ private final char[] soundexMapping; @@ -83,7 +85,7 @@ public class RefinedSoundex implements StringEncoder { * * @param mapping * Mapping array to use when finding the corresponding code for - * a given character + * a given character. */ public RefinedSoundex(final char[] mapping) { this.soundexMapping = mapping.clone(); @@ -94,7 +96,7 @@ public class RefinedSoundex implements StringEncoder { * and/or possibly provide an internationalized mapping for a non-Western character set. * * @param mapping - * Mapping string to use when finding the corresponding code for a given character + * Mapping string to use when finding the corresponding code for a given character. * @since 1.4 */ public RefinedSoundex(final String mapping) { @@ -120,7 +122,7 @@ public class RefinedSoundex implements StringEncoder { * MS T-SQL DIFFERENCE</a> * * @throws EncoderException - * if an error occurs encoding one of the strings + * if an error occurs encoding one of the strings. * @since 1.3 */ public int difference(final String s1, final String s2) throws EncoderException { @@ -134,8 +136,8 @@ public class RefinedSoundex implements StringEncoder { * {@link String}. * * @param obj - * Object to encode - * @return An object (or type {@link String}) containing the refined + * Object to encode. + * @return An object (or type {@link String}) containing the refined. * Soundex code which corresponds to the String supplied. * @throws EncoderException * if the parameter supplied is not of type {@link String} @@ -152,8 +154,8 @@ public class RefinedSoundex implements StringEncoder { * Encodes a String using the refined Soundex algorithm. * * @param str - * A String object to encode - * @return A Soundex code corresponding to the String supplied + * A String object to encode. + * @return A Soundex code corresponding to the String supplied. */ @Override public String encode(final String str) { @@ -166,8 +168,8 @@ public class RefinedSoundex implements StringEncoder { * default values of these mappings are US English. * * @param c - * char to get mapping for - * @return A character (really a numeral) to return for the given char + * char to get mapping for. + * @return A character (really a numeral) to return for the given char. */ char getMappingCode(final char c) { if (!Character.isLetter(c)) { @@ -184,8 +186,8 @@ public class RefinedSoundex implements StringEncoder { * Retrieves the Refined Soundex code for a given String object. * * @param str - * String to encode using the Refined Soundex algorithm - * @return A Soundex code for the String supplied + * String to encode using the Refined Soundex algorithm. + * @return A Soundex code for the String supplied. */ public String soundex(String str) { if (str == null) { diff --git a/src/main/java/org/apache/commons/codec/language/Soundex.java b/src/main/java/org/apache/commons/codec/language/Soundex.java index 5c12cd1f..bdf09957 100644 --- a/src/main/java/org/apache/commons/codec/language/Soundex.java +++ b/src/main/java/org/apache/commons/codec/language/Soundex.java @@ -135,7 +135,7 @@ public class Soundex implements StringEncoder { private final boolean specialCaseHW; /** - * Creates an instance using US_ENGLISH_MAPPING + * Creates an instance using US_ENGLISH_MAPPING. * * @see Soundex#Soundex(char[]) * @see Soundex#US_ENGLISH_MAPPING_STRING @@ -153,11 +153,11 @@ public class Soundex implements StringEncoder { * letter is mapped. This implementation contains a default map for US_ENGLISH * </p> * <p> - * If the mapping contains an instance of {@link #SILENT_MARKER} then H and W are not given special treatment + * If the mapping contains an instance of {@link #SILENT_MARKER} then H and W are not given special treatment. * </p> * * @param mapping - * Mapping array to use when finding the corresponding code for a given character + * Mapping array to use when finding the corresponding code for a given character. */ public Soundex(final char[] mapping) { this.soundexMapping = mapping.clone(); @@ -168,11 +168,11 @@ public class Soundex implements StringEncoder { * Creates a refined Soundex instance using a custom mapping. This constructor can be used to customize the mapping, * and/or possibly provide an internationalized mapping for a non-Western character set. * <p> - * If the mapping contains an instance of {@link #SILENT_MARKER} then H and W are not given special treatment + * If the mapping contains an instance of {@link #SILENT_MARKER} then H and W are not given special treatment. * </p> * * @param mapping - * Mapping string to use when finding the corresponding code for a given character + * Mapping string to use when finding the corresponding code for a given character. * @since 1.4 */ public Soundex(final String mapping) { @@ -185,7 +185,7 @@ public class Soundex implements StringEncoder { * and/or possibly provide an internationalized mapping for a non-Western character set. * * @param mapping - * Mapping string to use when finding the corresponding code for a given character + * Mapping string to use when finding the corresponding code for a given character. * @param specialCaseHW if true, then * @since 1.11 */ @@ -195,21 +195,16 @@ public class Soundex implements StringEncoder { } /** - * Encodes the Strings and returns the number of characters in the two encoded Strings that are the same. This - * return value ranges from 0 through 4: 0 indicates little or no similarity, and 4 indicates strong similarity or - * identical values. + * Encodes the Strings and returns the number of characters in the two encoded Strings that are the same. This return value ranges from 0 through 4: 0 + * indicates little or no similarity, and 4 indicates strong similarity or identical values. * - * @param s1 - * A String that will be encoded and compared. - * @param s2 - * A String that will be encoded and compared. + * @param s1 A String that will be encoded and compared. + * @param s2 A String that will be encoded and compared. * @return The number of characters in the two encoded Strings that are the same from 0 to 4. * @see SoundexUtils#difference(StringEncoder,String,String) - * @see <a href="https://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_de-dz_8co5.asp"> MS - * T-SQL DIFFERENCE</a> + * @see <a href="https://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_de-dz_8co5.asp"> MS T-SQL DIFFERENCE</a> * - * @throws EncoderException - * if an error occurs encoding one of the strings + * @throws EncoderException if an error occurs encoding one of the strings. * @since 1.3 */ public int difference(final String s1, final String s2) throws EncoderException { @@ -217,17 +212,13 @@ public class Soundex implements StringEncoder { } /** - * Encodes an Object using the Soundex 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}. + * Encodes an Object using the Soundex 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 Soundex code which corresponds to the String - * supplied. - * @throws EncoderException - * if the parameter supplied is not of type {@link String} - * @throws IllegalArgumentException - * if a character is not mapped + * @param obj Object to encode. + * @return An object (or type {@link String}) containing the Soundex code which corresponds to the String supplied. + * @throws EncoderException if the parameter supplied is not of type {@link String}. + * @throws IllegalArgumentException if a character is not mapped. */ @Override public Object encode(final Object obj) throws EncoderException { @@ -240,11 +231,9 @@ public class Soundex implements StringEncoder { /** * Encodes a String using the Soundex algorithm. * - * @param str - * A String object to encode - * @return A Soundex code corresponding to the String supplied - * @throws IllegalArgumentException - * if a character is not mapped + * @param str A String object to encode. + * @return A Soundex code corresponding to the String supplied. + * @throws IllegalArgumentException if a character is not mapped. */ @Override public String encode(final String str) { @@ -255,7 +244,7 @@ public class Soundex implements StringEncoder { * Returns the maxLength. Standard Soundex * * @deprecated This feature is not needed since the encoding size must be constant. Will be removed in 2.0. - * @return int + * @return the maxLength. */ @Deprecated public int getMaxLength() { @@ -293,7 +282,7 @@ public class Soundex implements StringEncoder { * * @deprecated This feature is not needed since the encoding size must be constant. Will be removed in 2.0. * @param maxLength - * The maxLength to set + * The maxLength to set. */ @Deprecated public void setMaxLength(final int maxLength) { @@ -303,11 +292,9 @@ public class Soundex implements StringEncoder { /** * Retrieves the Soundex code for a given String object. * - * @param str - * String to encode using the Soundex algorithm - * @return A Soundex code for the String supplied - * @throws IllegalArgumentException - * if a character is not mapped + * @param str String to encode using the Soundex algorithm. + * @return A Soundex code for the String supplied. + * @throws IllegalArgumentException if a character is not mapped. */ public String soundex(String str) { if (str == null) { 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 2750ffe1..93553a73 100644 --- a/src/main/java/org/apache/commons/codec/language/SoundexUtils.java +++ b/src/main/java/org/apache/commons/codec/language/SoundexUtils.java @@ -133,8 +133,8 @@ final class SoundexUtils { * StringUtils.isEmpty(" bob ") = false * </pre> * - * @param cs the CharSequence to check, may be null - * @return {@code true} if the CharSequence is empty or null + * @param cs the CharSequence to check, may be null. + * @return {@code true} if the CharSequence is empty or null. */ static boolean isEmpty(final CharSequence cs) { return cs == null || cs.length() == 0;