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 2021/07/24 15:11:17 UTC
[commons-text] 02/03: Misc Javadoc.
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-text.git
commit 87640ed259da32f6af516b9b638ae46d96c9ff24
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 24 11:09:27 2021 -0400
Misc Javadoc.
- Javadoc first sentence does not need to be in an explicit paragraph.
- Javadoc wording of start of first sentence "Get" -> "Gets" and so on.
- Match verb of first sentence to method, for example a build method
should say "Builds ..."; or vice-versa depending on context and method
visibility.
- Constructors "Constructs...".
- Getters "Gets..."
- Remove dead comments like "// ----..."
- Add missing HTML closing tags.
- Add empty line before a Javadoc comment.
---
.../org/apache/commons/text/AlphabetConverter.java | 23 ++--
src/main/java/org/apache/commons/text/Builder.java | 2 -
.../java/org/apache/commons/text/CaseUtils.java | 18 +--
.../apache/commons/text/CharacterPredicates.java | 2 -
.../org/apache/commons/text/CompositeFormat.java | 13 +-
.../apache/commons/text/ExtendedMessageFormat.java | 30 ++---
.../org/apache/commons/text/FormatFactory.java | 2 +-
.../org/apache/commons/text/FormattableUtils.java | 9 +-
.../apache/commons/text/RandomStringGenerator.java | 29 ++---
.../java/org/apache/commons/text/StrBuilder.java | 135 ++++++++++++---------
.../java/org/apache/commons/text/StrLookup.java | 13 +-
.../java/org/apache/commons/text/StrMatcher.java | 16 +--
.../org/apache/commons/text/StrSubstitutor.java | 70 ++++++-----
.../java/org/apache/commons/text/StrTokenizer.java | 45 ++++---
.../org/apache/commons/text/StringEscapeUtils.java | 61 +++++-----
.../org/apache/commons/text/StringTokenizer.java | 31 +++--
.../apache/commons/text/TextRandomProvider.java | 2 -
.../org/apache/commons/text/TextStringBuilder.java | 26 ++--
.../java/org/apache/commons/text/WordUtils.java | 61 ++++------
.../apache/commons/text/diff/CommandVisitor.java | 1 +
.../apache/commons/text/diff/DeleteCommand.java | 4 +-
.../org/apache/commons/text/diff/EditCommand.java | 5 +-
.../org/apache/commons/text/diff/EditScript.java | 16 +--
.../apache/commons/text/diff/InsertCommand.java | 4 +-
.../org/apache/commons/text/diff/KeepCommand.java | 4 +-
.../commons/text/diff/ReplacementsFinder.java | 2 +-
.../commons/text/diff/StringsComparator.java | 21 ++--
.../apache/commons/text/numbers/DoubleFormat.java | 60 ++++-----
.../apache/commons/text/numbers/ParsedDecimal.java | 60 ++++-----
.../commons/text/similarity/CosineDistance.java | 2 +
.../commons/text/similarity/EditDistanceFrom.java | 6 +-
.../apache/commons/text/similarity/FuzzyScore.java | 4 +-
.../text/similarity/IntersectionResult.java | 11 +-
.../text/similarity/IntersectionSimilarity.java | 10 +-
.../similarity/LevenshteinDetailedDistance.java | 7 +-
.../text/similarity/LevenshteinDistance.java | 8 +-
.../text/similarity/LevenshteinResults.java | 14 ++-
.../commons/text/similarity/RegexTokenizer.java | 1 +
.../text/similarity/SimilarityScoreFrom.java | 7 +-
.../text/translate/CharSequenceTranslator.java | 4 +-
.../text/translate/CodePointTranslator.java | 2 +-
.../commons/text/translate/EntityArrays.java | 14 ++-
.../commons/text/translate/JavaUnicodeEscaper.java | 10 --
.../commons/text/translate/LookupTranslator.java | 5 +-
.../text/translate/NumericEntityEscaper.java | 16 +--
.../commons/text/translate/OctalUnescaper.java | 6 +-
.../text/translate/SinglePassTranslator.java | 2 +-
.../commons/text/translate/UnicodeEscaper.java | 16 +--
48 files changed, 464 insertions(+), 446 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/AlphabetConverter.java b/src/main/java/org/apache/commons/text/AlphabetConverter.java
index 88a7bcd..1229732 100644
--- a/src/main/java/org/apache/commons/text/AlphabetConverter.java
+++ b/src/main/java/org/apache/commons/text/AlphabetConverter.java
@@ -79,14 +79,17 @@ public final class AlphabetConverter {
* Original string to be encoded.
*/
private final Map<Integer, String> originalToEncoded;
+
/**
* Encoding alphabet.
*/
private final Map<String, String> encodedToOriginal;
+
/**
* Length of the encoded letter.
*/
private final int encodedLetterLength;
+
/**
* Arrow constant, used for converting the object into a string.
*/
@@ -109,7 +112,7 @@ public final class AlphabetConverter {
}
/**
- * Encode a given string.
+ * Encodes a given string.
*
* @param original the string to be encoded
* @return The encoded string, {@code null} if the given string is null
@@ -147,7 +150,7 @@ public final class AlphabetConverter {
}
/**
- * Decode a given string.
+ * Decodes a given string.
*
* @param encoded a string that has been encoded using this
* AlphabetConverter
@@ -193,7 +196,7 @@ public final class AlphabetConverter {
}
/**
- * Get the length of characters in the encoded alphabet that are necessary
+ * Gets the length of characters in the encoded alphabet that are necessary
* for each character in the original
* alphabet.
*
@@ -204,7 +207,7 @@ public final class AlphabetConverter {
}
/**
- * Get the mapping from integer code point of source language to encoded
+ * Gets the mapping from integer code point of source language to encoded
* string. Use to reconstruct converter from
* serialized map.
*
@@ -310,10 +313,8 @@ public final class AlphabetConverter {
encodedLetterLength);
}
- // -- static methods
-
/**
- * Create a new converter from a map.
+ * Creates a new converter from a map.
*
* @param originalToEncoded a map returned from getOriginalToEncoded()
* @return The reconstructed AlphabetConverter
@@ -343,7 +344,7 @@ public final class AlphabetConverter {
}
/**
- * Create an alphabet converter, for converting from the original alphabet,
+ * Creates an alphabet converter, for converting from the original alphabet,
* to the encoded alphabet, while leaving the characters in
* <em>doNotEncode</em> as they are (if possible).
*
@@ -370,7 +371,7 @@ public final class AlphabetConverter {
}
/**
- * Convert characters to integers.
+ * Converts characters to integers.
*
* @param chars array of characters
* @return an equivalent array of integers
@@ -387,7 +388,7 @@ public final class AlphabetConverter {
}
/**
- * Create an alphabet converter, for converting from the original alphabet,
+ * Creates an alphabet converter, for converting from the original alphabet,
* to the encoded alphabet, while leaving
* the characters in <em>doNotEncode</em> as they are (if possible).
*
@@ -506,7 +507,7 @@ public final class AlphabetConverter {
}
/**
- * Create new String that contains just the given code point.
+ * Creates new String that contains just the given code point.
*
* @param i code point
* @return a new string with the new code point
diff --git a/src/main/java/org/apache/commons/text/Builder.java b/src/main/java/org/apache/commons/text/Builder.java
index cb05b75..5f5723c 100644
--- a/src/main/java/org/apache/commons/text/Builder.java
+++ b/src/main/java/org/apache/commons/text/Builder.java
@@ -17,12 +17,10 @@
package org.apache.commons.text;
/**
- * <p>
* The Builder interface is designed to designate a class as a <em>builder</em>
* object in the Builder design pattern. Builders are capable of creating and
* configuring objects or results that normally take multiple steps to construct
* or are very complex to derive.
- * </p>
*
* <p>
* The builder interface defines a single method, {@link #build()}, that
diff --git a/src/main/java/org/apache/commons/text/CaseUtils.java b/src/main/java/org/apache/commons/text/CaseUtils.java
index 74cebf3..497e5ee 100644
--- a/src/main/java/org/apache/commons/text/CaseUtils.java
+++ b/src/main/java/org/apache/commons/text/CaseUtils.java
@@ -23,7 +23,7 @@ import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
/**
- * <p>Case manipulation operations on Strings that contain words.</p>
+ * Case manipulation operations on Strings that contain words.
*
* <p>This class tries to handle {@code null} input gracefully.
* An exception will not be thrown for a {@code null} input.
@@ -34,9 +34,9 @@ import org.apache.commons.lang3.StringUtils;
public class CaseUtils {
/**
- * <p>{@code CaseUtils} instances should NOT be constructed in
+ * {@code CaseUtils} instances should NOT be constructed in
* standard programming. Instead, the class should be used as
- * {@code CaseUtils.toCamelCase("foo bar", true, new char[]{'-'});}.</p>
+ * {@code CaseUtils.toCamelCase("foo bar", true, new char[]{'-'});}.
*
* <p>This constructor is public to permit tools that require a JavaBean
* instance to operate.</p>
@@ -45,9 +45,9 @@ public class CaseUtils {
}
/**
- * <p>Converts all the delimiter separated words in a String into camelCase,
+ * Converts all the delimiter separated words in a String into camelCase,
* that is each word is made up of a title case character and then a series of
- * lowercase characters.</p>
+ * lowercase characters.
*
* <p>The delimiters represent a set of characters understood to separate words.
* The first non-delimiter character after a delimiter will be capitalized. The first String
@@ -85,7 +85,7 @@ public class CaseUtils {
final int strLen = str.length();
final int[] newCodePoints = new int[strLen];
int outOffset = 0;
- final Set<Integer> delimiterSet = generateDelimiterSet(delimiters);
+ final Set<Integer> delimiterSet = toDelimiterSet(delimiters);
boolean capitalizeNext = capitalizeFirstLetter;
for (int index = 0; index < strLen;) {
final int codePoint = str.codePointAt(index);
@@ -108,13 +108,13 @@ public class CaseUtils {
}
/**
- * <p>Converts an array of delimiters to a hash set of code points. Code point of space(32) is added
- * as the default value. The generated hash set provides O(1) lookup time.</p>
+ * Converts an array of delimiters to a hash set of code points. Code point of space(32) is added
+ * as the default value. The generated hash set provides O(1) lookup time.
*
* @param delimiters set of characters to determine capitalization, null means whitespace
* @return Set<Integer>
*/
- private static Set<Integer> generateDelimiterSet(final char[] delimiters) {
+ private static Set<Integer> toDelimiterSet(final char[] delimiters) {
final Set<Integer> delimiterHashSet = new HashSet<>();
delimiterHashSet.add(Character.codePointAt(new char[]{' '}, 0));
if (ArrayUtils.isEmpty(delimiters)) {
diff --git a/src/main/java/org/apache/commons/text/CharacterPredicates.java b/src/main/java/org/apache/commons/text/CharacterPredicates.java
index 3c99149..c174b74 100644
--- a/src/main/java/org/apache/commons/text/CharacterPredicates.java
+++ b/src/main/java/org/apache/commons/text/CharacterPredicates.java
@@ -17,10 +17,8 @@
package org.apache.commons.text;
/**
- * <p>
* Commonly used implementations of {@link CharacterPredicate}. Per the interface
* requirements, all implementations are thread safe.
- * </p>
*
* @since 1.0
*/
diff --git a/src/main/java/org/apache/commons/text/CompositeFormat.java b/src/main/java/org/apache/commons/text/CompositeFormat.java
index 7d5fd14..a53ca67 100644
--- a/src/main/java/org/apache/commons/text/CompositeFormat.java
+++ b/src/main/java/org/apache/commons/text/CompositeFormat.java
@@ -39,11 +39,12 @@ public class CompositeFormat extends Format {
/** The parser to use. */
private final Format parser;
+
/** The formatter to use. */
private final Format formatter;
/**
- * Create a format that points its parseObject method to one implementation
+ * Constructs a format that points its parseObject method to one implementation
* and its format method to another.
*
* @param parser implementation
@@ -55,7 +56,7 @@ public class CompositeFormat extends Format {
}
/**
- * Uses the formatter Format instance.
+ * Formats the input.
*
* @param obj the object to format
* @param toAppendTo the {@link StringBuffer} to append to
@@ -70,7 +71,7 @@ public class CompositeFormat extends Format {
}
/**
- * Uses the parser Format instance.
+ * Parses the input.
*
* @param source the String source
* @param pos the ParsePosition containing the position to parse from, will
@@ -85,7 +86,7 @@ public class CompositeFormat extends Format {
}
/**
- * Provides access to the parser Format implementation.
+ * Gets the parser Format implementation.
*
* @return parser Format implementation
*/
@@ -94,7 +95,7 @@ public class CompositeFormat extends Format {
}
/**
- * Provides access to the parser Format implementation.
+ * Gets the parser Format implementation.
*
* @return formatter Format implementation
*/
@@ -103,7 +104,7 @@ public class CompositeFormat extends Format {
}
/**
- * Utility method to parse and then reformat a String.
+ * Parses and then reformats a String.
*
* @param input String to reformat
* @return A reformatted String
diff --git a/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java b/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java
index 56ad987..f9682ff 100644
--- a/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java
+++ b/src/main/java/org/apache/commons/text/ExtendedMessageFormat.java
@@ -117,7 +117,7 @@ public class ExtendedMessageFormat extends MessageFormat {
private final Map<String, ? extends FormatFactory> registry;
/**
- * Create a new ExtendedMessageFormat for the default locale.
+ * Constructs a new ExtendedMessageFormat for the default locale.
*
* @param pattern the pattern to use, not null
* @throws IllegalArgumentException in case of a bad pattern.
@@ -127,7 +127,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Create a new ExtendedMessageFormat.
+ * Constructs a new ExtendedMessageFormat.
*
* @param pattern the pattern to use, not null
* @param locale the locale to use, not null
@@ -138,7 +138,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Create a new ExtendedMessageFormat for the default locale.
+ * Constructs a new ExtendedMessageFormat for the default locale.
*
* @param pattern the pattern to use, not null
* @param registry the registry of format factories, may be null
@@ -150,7 +150,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Create a new ExtendedMessageFormat.
+ * Constructs a new ExtendedMessageFormat.
*
* @param pattern the pattern to use, not null
* @param locale the locale to use, not null
@@ -177,7 +177,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Apply the specified pattern.
+ * Applies the specified pattern.
*
* @param pattern String
*/
@@ -304,7 +304,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Check if this extended message format is equal to another object.
+ * Tests if this extended message format is equal to another object.
*
* @param obj the object to compare to
* @return true if this object equals the other, otherwise false
@@ -342,7 +342,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Get a custom format from a format description.
+ * Gets a custom format from a format description.
*
* @param desc String
* @return Format
@@ -365,7 +365,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Read the argument index from the current format element.
+ * Reads the argument index from the current format element.
*
* @param pattern pattern to parse
* @param pos current parse position
@@ -407,7 +407,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Parse the format component of a format element.
+ * Parses the format component of a format element.
*
* @param pattern string to parse
* @param pos current parse position
@@ -444,7 +444,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Insert formats back into the pattern for toPattern() support.
+ * Inserts formats back into the pattern for toPattern() support.
*
* @param pattern source
* @param customPatterns The custom patterns to re-insert, if any
@@ -488,7 +488,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Consume whitespace from the current parse position.
+ * Consumes whitespace from the current parse position.
*
* @param pattern String to read
* @param pos current position
@@ -503,7 +503,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Convenience method to advance parse position by 1.
+ * Advances parse position by 1.
*
* @param pos ParsePosition
* @return {@code pos}
@@ -514,7 +514,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Consume a quoted string, adding it to {@code appendTo} if
+ * Consumes a quoted string, adding it to {@code appendTo} if
* specified.
*
* @param pattern pattern to parse
@@ -551,7 +551,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Consume quoted string only.
+ * Consumes quoted string only.
*
* @param pattern pattern to parse
* @param pos current parse position
@@ -561,7 +561,7 @@ public class ExtendedMessageFormat extends MessageFormat {
}
/**
- * Learn whether the specified Collection contains non-null elements.
+ * Tests whether the specified Collection contains non-null elements.
* @param coll to check
* @return {@code true} if some Object was found, {@code false} otherwise.
*/
diff --git a/src/main/java/org/apache/commons/text/FormatFactory.java b/src/main/java/org/apache/commons/text/FormatFactory.java
index d2908d3..dcf0e22 100644
--- a/src/main/java/org/apache/commons/text/FormatFactory.java
+++ b/src/main/java/org/apache/commons/text/FormatFactory.java
@@ -27,7 +27,7 @@ import java.util.Locale;
public interface FormatFactory {
/**
- * Create or retrieve a format instance.
+ * Gets or creates a format instance.
*
* @param name The format type name
* @param arguments Arguments used to create the format instance. This allows the
diff --git a/src/main/java/org/apache/commons/text/FormattableUtils.java b/src/main/java/org/apache/commons/text/FormattableUtils.java
index 78b5bc6..6f4936d 100644
--- a/src/main/java/org/apache/commons/text/FormattableUtils.java
+++ b/src/main/java/org/apache/commons/text/FormattableUtils.java
@@ -24,7 +24,7 @@ import java.util.Formatter;
import org.apache.commons.lang3.StringUtils;
/**
- * <p>Provides utilities for working with the {@code Formattable} interface.</p>
+ * Provides utilities for working with the {@code Formattable} interface.
*
* <p>The {@link Formattable} interface provides basic control over formatting
* when using a {@code Formatter}. It is primarily concerned with numeric precision
@@ -41,9 +41,9 @@ public class FormattableUtils {
private static final String SIMPLEST_FORMAT = "%s";
/**
- * <p>{@code FormattableUtils} instances should NOT be constructed in
+ * {@code FormattableUtils} instances should NOT be constructed in
* standard programming. Instead, the methods of the class should be invoked
- * statically.</p>
+ * statically.
*
* <p>This constructor is public to permit tools that require a JavaBean
* instance to operate.</p>
@@ -51,9 +51,8 @@ public class FormattableUtils {
public FormattableUtils() {
}
- //-----------------------------------------------------------------------
/**
- * Get the default formatted representation of the specified
+ * Gets the default formatted representation of the specified
* {@code Formattable}.
*
* @param formattable the instance to convert to a string, not null
diff --git a/src/main/java/org/apache/commons/text/RandomStringGenerator.java b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
index 3a36e5d..62f127d 100644
--- a/src/main/java/org/apache/commons/text/RandomStringGenerator.java
+++ b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
@@ -28,12 +28,11 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
/**
- * <p>
* Generates random Unicode strings containing the specified number of code points.
* Instances are created using a builder class, which allows the
* callers to define the properties of the generator. See the documentation for the
* {@link Builder} class to see available properties.
- * </p>
+ *
* <pre>
* // Generates a 20 code point string, using only the letters a-z
* RandomStringGenerator generator = new RandomStringGenerator.Builder()
@@ -141,10 +140,10 @@ public final class RandomStringGenerator {
}
/**
- * <p>
* Generates a random string, containing the specified number of code points.
- * </p>
- * <p>Code points are randomly selected between the minimum and maximum values defined
+ *
+ * <p>
+ * Code points are randomly selected between the minimum and maximum values defined
* in the generator.
* Surrogate and private use characters are not returned, although the
* resulting string may contain pairs of surrogates that together encode a
@@ -230,7 +229,8 @@ public final class RandomStringGenerator {
}
/**
- * <p>A builder for generating {@code RandomStringGenerator} instances.</p>
+ * A builder for generating {@code RandomStringGenerator} instances.
+ *
* <p>The behavior of a generator is controlled by properties set by this
* builder. Each property has a default value, which can be overridden by
* calling the methods defined in this class, prior to calling {@link #build()}.</p>
@@ -295,10 +295,8 @@ public final class RandomStringGenerator {
private List<Character> characterList;
/**
- * <p>
- * Specifies the minimum and maximum code points allowed in the
+ * Sets the minimum and maximum code points allowed in the
* generated string.
- * </p>
*
* @param minimumCodePoint
* the smallest code point allowed (inclusive)
@@ -326,10 +324,8 @@ public final class RandomStringGenerator {
}
/**
- * <p>
- * Specifies the array of minimum and maximum char allowed in the
+ * Sets the array of minimum and maximum char allowed in the
* generated string.
- * </p>
*
* For example:
* <pre>
@@ -362,10 +358,8 @@ public final class RandomStringGenerator {
}
/**
- * <p>
* Limits the characters in the generated string to those that match at
* least one of the predicates supplied.
- * </p>
*
* <p>
* Passing {@code null} or an empty array to this method will revert to the
@@ -395,12 +389,10 @@ public final class RandomStringGenerator {
}
/**
- * <p>
* Overrides the default source of randomness. It is highly
* recommended that a random number generator library like
* <a href="https://commons.apache.org/proper/commons-rng/">Apache Commons RNG</a>
* be used to provide the random number generation.
- * </p>
*
* <p>
* When using Java 8 or later, {@link TextRandomProvider} is a
@@ -431,10 +423,8 @@ public final class RandomStringGenerator {
}
/**
- * <p>
* Limits the characters in the generated string to those who match at
* supplied list of Character.
- * </p>
*
* <p>
* Passing {@code null} or an empty array to this method will revert to the
@@ -456,7 +446,8 @@ public final class RandomStringGenerator {
}
/**
- * <p>Builds the {@code RandomStringGenerator} using the properties specified.</p>
+ * Builds the {@code RandomStringGenerator} using the properties specified.
+ *
* @return The configured {@code RandomStringGenerator}
*/
@Override
diff --git a/src/main/java/org/apache/commons/text/StrBuilder.java b/src/main/java/org/apache/commons/text/StrBuilder.java
index 03296a3..d5e3aea 100644
--- a/src/main/java/org/apache/commons/text/StrBuilder.java
+++ b/src/main/java/org/apache/commons/text/StrBuilder.java
@@ -73,13 +73,14 @@ import org.apache.commons.lang3.StringUtils;
@Deprecated
public class StrBuilder implements CharSequence, Appendable, Serializable, Builder<String> {
- //-----------------------------------------------------------------------
/**
* Inner class to allow StrBuilder to operate as a reader.
*/
class StrBuilderReader extends Reader {
+
/** The current stream position. */
private int pos;
+
/** The last mark position. */
private int mark;
@@ -163,7 +164,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
}
- //-----------------------------------------------------------------------
/**
* Inner class to allow StrBuilder to operate as a tokenizer.
*/
@@ -196,7 +196,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
}
- //-----------------------------------------------------------------------
/**
* Inner class to allow StrBuilder to operate as a writer.
*/
@@ -250,16 +249,19 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
StrBuilder.this.append(str, off, len);
}
}
+
/**
* The extra capacity for new builders.
*/
static final int CAPACITY = 32;
+
/**
* Required for serialization support.
*
* @see java.io.Serializable
*/
private static final long serialVersionUID = 7628716375283629643L;
+
/** Internal data storage. */
char[] buffer; // package-protected for test code use only
@@ -272,16 +274,15 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
/** The null text. */
private String nullText;
- //-----------------------------------------------------------------------
/**
- * Constructor that creates an empty builder initial capacity 32 characters.
+ * Constructs an empty builder initial capacity 32 characters.
*/
public StrBuilder() {
this(CAPACITY);
}
/**
- * Constructor that creates an empty builder the specified initial capacity.
+ * Constructs an empty builder the specified initial capacity.
*
* @param initialCapacity the initial capacity, zero or less will be converted to 32
*/
@@ -293,7 +294,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Constructor that creates a builder from the string, allocating
+ * Constructs a builder from the string, allocating
* 32 extra characters for growth.
*
* @param str the string to copy, null treated as blank string
@@ -791,8 +792,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
-
- //-----------------------------------------------------------------------
/**
* Appends each item in an array to the builder without any separators.
* Appending a null array will have no effect.
@@ -831,7 +830,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return appendFixedWidthPadLeft(String.valueOf(value), width, padChar);
}
- //-----------------------------------------------------------------------
/**
* Appends an object to the builder padding on the left to a fixed width.
* The {@code toString} of the object is used.
@@ -1116,14 +1114,13 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return append(str, startIndex, length).appendNewLine();
}
- //-----------------------------------------------------------------------
/**
* Appends the new line string to this string builder.
* <p>
* The new line string can be altered using {@link #setNewLineText(String)}.
* This might be used to force the output to always use Unix line endings
* even when on Windows.
- *
+ * </p>
* @return this, to enable chaining
*/
public StrBuilder appendNewLine() {
@@ -1146,7 +1143,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return append(nullText);
}
- //-----------------------------------------------------------------------
/**
* Appends the pad character to the builder the specified number of times.
*
@@ -1170,14 +1166,17 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* <p>
* This method is useful for adding a separator each time around the
* loop except the first.
+ * </p>
* <pre>
* for (Iterator it = list.iterator(); it.hasNext();){
* appendSeparator(',');
* append(it.next());
* }
* </pre>
+ * <p>
* Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}.
+ * </p>
*
* @param separator the separator to use
* @return this, to enable chaining
@@ -1190,7 +1189,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Append one of both separators to the builder
+ * Appends one of both separators to the builder
* If the builder is currently empty it will append the defaultIfEmpty-separator
* Otherwise it will append the standard-separator
*
@@ -1221,8 +1220,10 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* append(list.get(i));
* }
* </pre>
+ * <p>
* Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}.
+ * </p>
*
* @param separator the separator to use
* @param loopIndex the loop index
@@ -1235,7 +1236,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Appends a separator if the builder is currently non-empty.
* Appending a null separator will have no effect.
@@ -1243,14 +1243,17 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* <p>
* This method is useful for adding a separator each time around the
* loop except the first.
+ * </p>
* <pre>
* for (Iterator it = list.iterator(); it.hasNext();){
* appendSeparator(",");
* append(it.next());
* }
* </pre>
+ * <p>
* Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}.
+ * </p>
*
* @param separator the separator to use, null means no separator
* @return this, to enable chaining
@@ -1273,8 +1276,10 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* append(list.get(i));
* }
* </pre>
+ * <p>
* Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}.
+ * </p>
*
* @param separator the separator to use, null means no separator
* @param loopIndex the loop index
@@ -1291,20 +1296,22 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Appends one of both separators to the StrBuilder.
* If the builder is currently empty it will append the defaultIfEmpty-separator
* Otherwise it will append the standard-separator
- *
+ * <p>
* Appending a null separator will have no effect.
* The separator is appended using {@link #append(String)}.
+ * </p>
* <p>
* This method is for example useful for constructing queries
+ * </p>
* <pre>
* StrBuilder whereClause = new StrBuilder();
* if(searchCommand.getPriority() != null) {
- * whereClause.appendSeparator(" and", " where");
- * whereClause.append(" priority = ?")
+ * whereClause.appendSeparator(" and", " where");
+ * whereClause.append(" priority = ?")
* }
* if(searchCommand.getComponent() != null) {
- * whereClause.appendSeparator(" and", " where");
- * whereClause.append(" component = ?")
+ * whereClause.appendSeparator(" and", " where");
+ * whereClause.append(" component = ?")
* }
* selectClause.append(whereClause)
* </pre>
@@ -1326,6 +1333,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* provided {@link Appendable}.
* <p>
* This method tries to avoid doing any extra copies of contents.
+ * </p>
*
* @param appendable the appendable to append data to
* @throws IOException if an I/O error occurs
@@ -1393,7 +1401,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Appends an array placing separators between each value, but
* not before the first or after the last.
@@ -1416,23 +1423,26 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Gets the contents of this builder as a Reader.
* <p>
* This method allows the contents of the builder to be read
* using any standard method that expects a Reader.
+ * </p>
* <p>
* To use, simply create a {@code StrBuilder}, populate it with
* data, call {@code asReader}, and then read away.
+ * </p>
* <p>
* The internal character array is shared between the builder and the reader.
* This allows you to append to the builder after creating the reader,
* and the changes will be picked up.
* Note however, that no synchronization occurs, so you must perform
* all operations with the builder and the reader in one thread.
+ * </p>
* <p>
* The returned reader supports marking, and ignores the flush method.
+ * </p>
*
* @return a reader that reads from this builder
*/
@@ -1440,7 +1450,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return new StrBuilderReader();
}
- //-----------------------------------------------------------------------
/**
* Creates a tokenizer that can tokenize the contents of this builder.
* <p>
@@ -1448,12 +1457,14 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* The tokenizer will be setup by default to tokenize on space, tab,
* newline and form feed (as per StringTokenizer). These values can be
* changed on the tokenizer class, before retrieving the tokens.
+ * </p>
* <p>
* The returned tokenizer is linked to this builder. You may intermix
* calls to the builder and tokenizer within certain limits, however
* there is no synchronization. Once the tokenizer has been used once,
* it must be {@link StrTokenizer#reset() reset} to pickup the latest
* changes in the builder. For example:
+ * </p>
* <pre>
* StrBuilder b = new StrBuilder();
* b.append("a b ");
@@ -1464,12 +1475,15 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* t.reset(); // reset causes builder changes to be picked up
* String[] tokens3 = t.getTokenArray(); // returns a,b,c,d
* </pre>
+ * <p>
* In addition to simply intermixing appends and tokenization, you can also
* call the set methods on the tokenizer to alter how it tokenizes. Just
* remember to call reset when you want to pickup builder changes.
+ * </p>
* <p>
* Calling {@link StrTokenizer#reset(String)} or {@link StrTokenizer#reset(char[])}
* with a non-null value will break the link with the builder.
+ * </p>
*
* @return a tokenizer that is linked to this builder
*/
@@ -1477,24 +1491,27 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return new StrBuilderTokenizer();
}
- //-----------------------------------------------------------------------
/**
* Gets this builder as a Writer that can be written to.
* <p>
* This method allows you to populate the contents of the builder
* using any standard method that takes a Writer.
+ * </p>
* <p>
* To use, simply create a {@code StrBuilder},
* call {@code asWriter}, and populate away. The data is available
* at any time using the methods of the {@code StrBuilder}.
+ * </p>
* <p>
* The internal character array is shared between the builder and the writer.
* This allows you to intermix calls that append to the builder and
* write using the writer and the changes will be occur correctly.
* Note however, that no synchronization occurs, so you must perform
* all operations with the builder and the writer in one thread.
+ * </p>
* <p>
* The returned writer ignores the close and flush methods.
+ * </p>
*
* @return a writer that populates this builder
*/
@@ -1503,7 +1520,8 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Implement the {@link Builder} interface.
+ * Builds a string.
+ *
* @return The builder as a String
* @see #toString()
*/
@@ -1512,7 +1530,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return toString();
}
- //-----------------------------------------------------------------------
/**
* Gets the current size of the internal character array buffer.
*
@@ -1522,7 +1539,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return buffer.length;
}
- //-----------------------------------------------------------------------
/**
* Gets the character at the specified index.
*
@@ -1545,9 +1561,11 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* <p>
* This method does not reduce the size of the internal character buffer.
* To do that, call {@code clear()} followed by {@link #minimizeCapacity()}.
+ * </p>
* <p>
* This method is the same as {@link #setLength(int)} called with zero
* and is provided to match the API of Collections.
+ * </p>
*
* @return this, to enable chaining
*/
@@ -1556,7 +1574,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Checks if the string builder contains the specified char.
*
@@ -1574,7 +1591,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Checks if the string builder contains the specified string.
+ * Tests if the string builder contains the specified string.
*
* @param str the string to find
* @return true if the builder contains the string
@@ -1584,12 +1601,13 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Checks if the string builder contains a string matched using the
+ * Tests if the string builder contains a string matched using the
* specified matcher.
* <p>
* Matchers can be used to perform advanced searching behavior.
* For example you could write a matcher to search for the character
* 'a' followed by a number.
+ * </p>
*
* @param matcher the matcher to use, null returns -1
* @return true if the matcher finds a match in the builder
@@ -1597,6 +1615,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
public boolean contains(final StrMatcher matcher) {
return indexOf(matcher, 0) >= 0;
}
+
/**
* Deletes the characters between the two specified indices.
*
@@ -1615,7 +1634,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Deletes the character wherever it occurs in the builder.
*
@@ -1639,7 +1657,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Deletes the string wherever it occurs in the builder.
*
@@ -1658,13 +1675,13 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Deletes all parts of the builder that the matcher matches.
* <p>
* Matchers can be used to perform advanced deletion behavior.
* For example you could write a matcher to delete all occurrences
* where the character 'a' is followed by a number.
+ * </p>
*
* @param matcher the matcher to use to find the deletion, null causes no action
* @return this, to enable chaining
@@ -1729,6 +1746,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Matchers can be used to perform advanced deletion behavior.
* For example you could write a matcher to delete
* where the character 'a' is followed by a number.
+ * </p>
*
* @param matcher the matcher to use to find the deletion, null causes no action
* @return this, to enable chaining
@@ -1737,7 +1755,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return replace(matcher, null, 0, size, 1);
}
- //-----------------------------------------------------------------------
/**
* Internal method to delete a range without validation.
*
@@ -1752,9 +1769,10 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Checks whether this builder ends with the specified string.
+ * Tests whether this builder ends with the specified string.
* <p>
* Note that this method handles null input quietly, unlike String.
+ * </p>
*
* @param str the string to search for, null returns false
* @return true if the builder ends with the string
@@ -1780,7 +1798,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Checks the capacity and ensures that it is at least the size specified.
+ * Tests the capacity and ensures that it is at least the size specified.
*
* @param capacity the capacity to ensure
* @return this, to enable chaining
@@ -1795,7 +1813,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Checks the contents of this builder against another to see if they
+ * Tests the contents of this builder against another to see if they
* contain the same character content.
*
* @param obj the object to check, null returns false
@@ -1808,7 +1826,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Checks the contents of this builder against another to see if they
+ * Tests the contents of this builder against another to see if they
* contain the same character content.
*
* @param other the object to check, null returns false
@@ -1835,7 +1853,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
/**
- * Checks the contents of this builder against another to see if they
+ * Tests the contents of this builder against another to see if they
* contain the same character content ignoring case.
*
* @param other the object to check, null returns false
@@ -1901,7 +1919,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
System.arraycopy(buffer, startIndex, destination, destinationIndex, endIndex - startIndex);
}
- //-----------------------------------------------------------------------
/**
* Gets the text to be appended when a new line is added.
*
@@ -1911,7 +1928,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return newLine;
}
- //-----------------------------------------------------------------------
/**
* Gets the text to be appended when null is added.
*
@@ -1936,7 +1952,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return hash;
}
- //-----------------------------------------------------------------------
/**
* Searches the string builder to find the first reference to the specified char.
*
@@ -1972,6 +1987,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Searches the string builder to find the first reference to the specified string.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
+ * </p>
*
* @param str the string to find, null returns -1
* @return The first index of the string, or -1 if not found
@@ -1985,6 +2001,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* string starting searching from the given index.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
+ * </p>
*
* @param str the string to find, null returns -1
* @param startIndex the index to start at, invalid index rounded to edge
@@ -2025,6 +2042,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Matchers can be used to perform advanced searching behavior.
* For example you could write a matcher to find the character 'a'
* followed by a number.
+ * </p>
*
* @param matcher the matcher to use, null returns -1
* @return The first index matched, or -1 if not found
@@ -2040,6 +2058,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Matchers can be used to perform advanced searching behavior.
* For example you could write a matcher to find the character 'a'
* followed by a number.
+ * </p>
*
* @param matcher the matcher to use, null returns -1
* @param startIndex the index to start at, invalid index rounded to edge
@@ -2260,6 +2279,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* <p>
* This method is the same as checking {@link #length()} and is provided to match the
* API of Collections.
+ * </p>
*
* @return {@code true} if the size is {@code 0}.
*/
@@ -2272,6 +2292,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* <p>
* This method is the same as checking {@link #length()} and is provided to match the
* API of Collections.
+ * </p>
*
* @return {@code true} if the size is greater than {@code 0}.
* @since 1.10.0
@@ -2280,7 +2301,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return size > 0;
}
- //-----------------------------------------------------------------------
/**
* Searches the string builder to find the last reference to the specified char.
*
@@ -2315,6 +2335,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Searches the string builder to find the last reference to the specified string.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
+ * </p>
*
* @param str the string to find, null returns -1
* @return The last index of the string, or -1 if not found
@@ -2328,6 +2349,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* string starting searching from the given index.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
+ * </p>
*
* @param str the string to find, null returns -1
* @param startIndex the index to start at, invalid index rounded to edge
@@ -2366,6 +2388,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Matchers can be used to perform advanced searching behavior.
* For example you could write a matcher to find the character 'a'
* followed by a number.
+ * </p>
*
* @param matcher the matcher to use, null returns -1
* @return The last index matched, or -1 if not found
@@ -2381,6 +2404,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Matchers can be used to perform advanced searching behavior.
* For example you could write a matcher to find the character 'a'
* followed by a number.
+ * </p>
*
* @param matcher the matcher to use, null returns -1
* @param startIndex the index to start at, invalid index rounded to edge
@@ -2409,6 +2433,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* the builder. If this many characters are not available, the whole
* builder is returned. Thus the returned string may be shorter than the
* length requested.
+ * </p>
*
* @param length the number of characters to extract, negative returns empty string
* @return The new string
@@ -2423,7 +2448,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return new String(buffer, 0, length);
}
- //-----------------------------------------------------------------------
/**
* Gets the length of the string builder.
*
@@ -2445,6 +2469,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* If the length is negative, the empty string is returned.
* If insufficient characters are available in the builder, as much as possible is returned.
* Thus the returned string may be shorter than the length requested.
+ * </p>
*
* @param index the index to start at, negative means zero
* @param length the number of characters to extract, negative returns empty string
@@ -2477,7 +2502,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* If possible, reads chars from the provided {@link Readable} directly into underlying
* character buffer without making extra copies.
@@ -2536,13 +2560,13 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- // -----------------------------------------------------------------------
/**
* Advanced search and replaces within the builder using a matcher.
* <p>
* Matchers can be used to perform advanced behavior.
* For example you could write a matcher to delete all occurrences
* where the character 'a' is followed by a number.
+ * </p>
*
* @param matcher the matcher to use to find the deletion, null causes no action
* @param replaceStr the string to replace the match with, null is a delete
@@ -2560,7 +2584,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return replaceImpl(matcher, replaceStr, startIndex, endIndex, replaceCount);
}
- //-----------------------------------------------------------------------
/**
* Replaces the search character with the replace character
* throughout the builder.
@@ -2580,7 +2603,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Replaces the search string with the replace string throughout the builder.
*
@@ -2601,13 +2623,13 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Replaces all matches within the builder with the replace string.
* <p>
* Matchers can be used to perform advanced replace behavior.
* For example you could write a matcher to replace all occurrences
* where the character 'a' is followed by a number.
+ * </p>
*
* @param matcher the matcher to use to find the deletion, null causes no action
* @param replaceStr the replace string, null is equivalent to an empty string
@@ -2662,6 +2684,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Matchers can be used to perform advanced replace behavior.
* For example you could write a matcher to replace
* where the character 'a' is followed by a number.
+ * </p>
*
* @param matcher the matcher to use to find the deletion, null causes no action
* @param replaceStr the replace string, null is equivalent to an empty string
@@ -2671,7 +2694,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return replace(matcher, replaceStr, 0, size, 1);
}
- //-----------------------------------------------------------------------
/**
* Internal method to delete a range without validation.
*
@@ -2704,6 +2726,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* Matchers can be used to perform advanced behavior.
* For example you could write a matcher to delete all occurrences
* where the character 'a' is followed by a number.
+ * </p>
*
* @param matcher the matcher to use to find the deletion, null causes no action
* @param replaceStr the string to replace the match with, null is a delete
@@ -2735,7 +2758,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Reverses the string builder placing each character in the opposite index.
*
@@ -2764,6 +2786,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* the builder. If this many characters are not available, the whole
* builder is returned. Thus the returned string may be shorter than the
* length requested.
+ * </p>
*
* @param length the number of characters to extract, negative returns empty string
* @return The new string
@@ -2846,12 +2869,12 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return this;
}
- //-----------------------------------------------------------------------
/**
* Gets the length of the string builder.
* <p>
* This method is the same as {@link #length()} and is provided to match the
* API of Collections.
+ * </p>
*
* @return The length
*/
@@ -2859,11 +2882,11 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return size;
}
- //-----------------------------------------------------------------------
/**
* Checks whether this builder starts with the specified string.
* <p>
* Note that this method handles null input quietly, unlike String.
+ * </p>
*
* @param str the string to search for, null returns false
* @return true if the builder starts with the string
@@ -2887,7 +2910,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return true;
}
- //-----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@@ -2934,7 +2956,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return new String(buffer, startIndex, endIndex - startIndex);
}
- //-----------------------------------------------------------------------
/**
* Copies the builder's character array into a new character array.
*
@@ -2970,13 +2991,13 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return chars;
}
- //-----------------------------------------------------------------------
/**
* Gets a String version of the string builder, creating a new instance
* each time the method is called.
* <p>
* Note that unlike StringBuffer, the string version returned is
* independent of the string builder.
+ * </p>
*
* @return The builder as a String
*/
@@ -3005,7 +3026,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
return new StringBuilder(size).append(buffer, 0, size);
}
- //-----------------------------------------------------------------------
/**
* Trims the builder by removing characters less than or equal to a space
* from the beginning and end.
@@ -3046,7 +3066,6 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
}
}
- //-----------------------------------------------------------------------
/**
* Validates parameters defining a range of the builder.
*
diff --git a/src/main/java/org/apache/commons/text/StrLookup.java b/src/main/java/org/apache/commons/text/StrLookup.java
index 12e9431..3f040b5 100644
--- a/src/main/java/org/apache/commons/text/StrLookup.java
+++ b/src/main/java/org/apache/commons/text/StrLookup.java
@@ -27,12 +27,15 @@ import org.apache.commons.text.lookup.StringLookupFactory;
* <p>
* This class represents the simplest form of a string to string map. It has a benefit over a map in that it can create
* the result on demand based on the key.
+ * </p>
* <p>
* This class comes complete with various factory methods. If these do not suffice, you can subclass and implement your
* own matcher.
+ * </p>
* <p>
* For example, it would be possible to implement a lookup that used the key as a primary key, and looked up the value
* on demand from the database
+ * </p>
*
* @param <V> the type of the values supported by the lookup
* @since 1.0
@@ -51,7 +54,6 @@ public abstract class StrLookup<V> implements StringLookup {
*/
private static final StrLookup<String> SYSTEM_PROPERTIES_LOOKUP = new SystemPropertiesStrLookup();
- // -----------------------------------------------------------------------
/**
* Returns a lookup which always returns null.
*
@@ -65,8 +67,10 @@ public abstract class StrLookup<V> implements StringLookup {
* Returns a new lookup which uses a copy of the current {@link System#getProperties() System properties}.
* <p>
* If a security manager blocked access to system properties, then null will be returned from every lookup.
+ * </p>
* <p>
* If a null key is used, this lookup will throw a NullPointerException.
+ * </p>
*
* @return a lookup using system properties, not null
*/
@@ -79,6 +83,7 @@ public abstract class StrLookup<V> implements StringLookup {
* <p>
* If the map is null, then null will be returned from every lookup. The map result object is converted to a string
* using toString().
+ * </p>
*
* @param <V> the type of the values supported by the lookup
* @param map the map of keys to values, may be null
@@ -93,6 +98,7 @@ public abstract class StrLookup<V> implements StringLookup {
* <p>
* If the ResourceBundle is null, then null will be returned from every lookup. The map result object is converted
* to a string using toString().
+ * </p>
*
* @param resourceBundle the map of keys to values, may be null
* @return a lookup using the map, not null
@@ -102,14 +108,12 @@ public abstract class StrLookup<V> implements StringLookup {
return new ResourceBundleLookup(resourceBundle);
}
- // -----------------------------------------------------------------------
/**
* Constructor.
*/
protected StrLookup() {
}
- // -----------------------------------------------------------------------
/**
* Lookup implementation that uses a Map.
*
@@ -133,6 +137,7 @@ public abstract class StrLookup<V> implements StringLookup {
* Looks up a String key to a String value using the map.
* <p>
* If the map is null, then null is returned. The map result object is converted to a string using toString().
+ * </p>
*
* @param key the key to be looked up, may be null
* @return The matching value, null if no match
@@ -155,7 +160,6 @@ public abstract class StrLookup<V> implements StringLookup {
}
}
- // -----------------------------------------------------------------------
/**
* Lookup implementation based on a ResourceBundle.
*/
@@ -188,7 +192,6 @@ public abstract class StrLookup<V> implements StringLookup {
}
- // -----------------------------------------------------------------------
/**
* Lookup implementation based on system properties.
*/
diff --git a/src/main/java/org/apache/commons/text/StrMatcher.java b/src/main/java/org/apache/commons/text/StrMatcher.java
index 9996643..cf7204a 100644
--- a/src/main/java/org/apache/commons/text/StrMatcher.java
+++ b/src/main/java/org/apache/commons/text/StrMatcher.java
@@ -27,6 +27,7 @@ import org.apache.commons.text.matcher.StringMatcherFactory;
* <p>
* This class comes complete with various factory methods.
* If these do not suffice, you can subclass and implement your own matcher.
+ * </p>
*
* @since 1.0
* @deprecated Deprecated as of 1.3, use {@link StringMatcherFactory} instead. This class will be removed in 2.0.
@@ -80,8 +81,6 @@ public abstract class StrMatcher {
*/
private static final StrMatcher NONE_MATCHER = new NoMatcher();
- // -----------------------------------------------------------------------
-
/**
* Returns a matcher which matches the comma character.
*
@@ -219,7 +218,6 @@ public abstract class StrMatcher {
return new StringMatcher(str);
}
- //-----------------------------------------------------------------------
/**
* Constructor.
*/
@@ -234,16 +232,20 @@ public abstract class StrMatcher {
* checked in the string {@code buffer} (a character array which must
* not be changed).
* The API guarantees that {@code pos} is a valid index for {@code buffer}.
+ * </p>
* <p>
* The character array may be larger than the active area to be matched.
* Only values in the buffer between the specified indices may be accessed.
+ * </p>
* <p>
* The matching code may check one character or many.
* It may check characters preceding {@code pos} as well as those
* after, so long as no checks exceed the bounds specified.
+ * </p>
* <p>
* It must return zero for no match, or a positive number if a match was found.
* The number indicates the number of characters that matched.
+ * </p>
*
* @param buffer the text content to match against, do not change
* @param pos the starting position for the match, valid for buffer
@@ -261,12 +263,15 @@ public abstract class StrMatcher {
* checked in the string {@code buffer} (a character array which must
* not be changed).
* The API guarantees that {@code pos} is a valid index for {@code buffer}.
+ * </p>
* <p>
* The matching code may check one character or many.
* It may check characters preceding {@code pos} as well as those after.
+ * </p>
* <p>
* It must return zero for no match, or a positive number if a match was found.
* The number indicates the number of characters that matched.
+ * </p>
*
* @param buffer the text content to match against, do not change
* @param pos the starting position for the match, valid for buffer
@@ -276,7 +281,6 @@ public abstract class StrMatcher {
return isMatch(buffer, pos, 0, buffer.length);
}
- //-----------------------------------------------------------------------
/**
* Class used to define a set of characters for matching purposes.
*/
@@ -309,7 +313,6 @@ public abstract class StrMatcher {
}
}
- //-----------------------------------------------------------------------
/**
* Class used to define a character for matching purposes.
*/
@@ -341,7 +344,6 @@ public abstract class StrMatcher {
}
}
- //-----------------------------------------------------------------------
/**
* Class used to define a set of characters for matching purposes.
*/
@@ -388,7 +390,6 @@ public abstract class StrMatcher {
}
- //-----------------------------------------------------------------------
/**
* Class used to match no characters.
*/
@@ -415,7 +416,6 @@ public abstract class StrMatcher {
}
}
- //-----------------------------------------------------------------------
/**
* Class used to match whitespace as per trim().
*/
diff --git a/src/main/java/org/apache/commons/text/StrSubstitutor.java b/src/main/java/org/apache/commons/text/StrSubstitutor.java
index 42fee5e..072401f 100644
--- a/src/main/java/org/apache/commons/text/StrSubstitutor.java
+++ b/src/main/java/org/apache/commons/text/StrSubstitutor.java
@@ -186,7 +186,6 @@ public class StrSubstitutor {
*/
private boolean disableSubstitutionInValues;
- //-----------------------------------------------------------------------
/**
* Replaces all the occurrences of variables in the given source object with
* their matching values from the map.
@@ -253,9 +252,8 @@ public class StrSubstitutor {
return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);
}
- //-----------------------------------------------------------------------
/**
- * Creates a new instance with defaults for variable prefix and suffix
+ * Constructs a new instance with defaults for variable prefix and suffix
* and the escaping character.
*/
public StrSubstitutor() {
@@ -263,7 +261,7 @@ public class StrSubstitutor {
}
/**
- * Creates a new instance and initializes it. Uses defaults for variable
+ * Constructs a new instance and initializes it. Uses defaults for variable
* prefix and suffix and the escaping character.
*
* @param <V> the type of the values in the map
@@ -274,7 +272,7 @@ public class StrSubstitutor {
}
/**
- * Creates a new instance and initializes it. Uses a default escaping character.
+ * Constructs a new instance and initializes it. Uses a default escaping character.
*
* @param <V> the type of the values in the map
* @param valueMap the map with the variables' values, may be null
@@ -287,7 +285,7 @@ public class StrSubstitutor {
}
/**
- * Creates a new instance and initializes it.
+ * Constructs a new instance and initializes it.
*
* @param <V> the type of the values in the map
* @param valueMap the map with the variables' values, may be null
@@ -302,7 +300,7 @@ public class StrSubstitutor {
}
/**
- * Creates a new instance and initializes it.
+ * Constructs a new instance and initializes it.
*
* @param <V> the type of the values in the map
* @param valueMap the map with the variables' values, may be null
@@ -318,7 +316,7 @@ public class StrSubstitutor {
}
/**
- * Creates a new instance and initializes it.
+ * Constructs a new instance and initializes it.
*
* @param variableResolver the variable resolver, may be null
*/
@@ -327,7 +325,7 @@ public class StrSubstitutor {
}
/**
- * Creates a new instance and initializes it.
+ * Constructs a new instance and initializes it.
*
* @param variableResolver the variable resolver, may be null
* @param prefix the prefix for variables, not null
@@ -345,7 +343,7 @@ public class StrSubstitutor {
}
/**
- * Creates a new instance and initializes it.
+ * Constructs a new instance and initializes it.
*
* @param variableResolver the variable resolver, may be null
* @param prefix the prefix for variables, not null
@@ -364,7 +362,7 @@ public class StrSubstitutor {
}
/**
- * Creates a new instance and initializes it.
+ * Constructs a new instance and initializes it.
*
* @param variableResolver the variable resolver, may be null
* @param prefixMatcher the prefix for variables, not null
@@ -379,7 +377,7 @@ public class StrSubstitutor {
}
/**
- * Creates a new instance and initializes it.
+ * Constructs a new instance and initializes it.
*
* @param variableResolver the variable resolver, may be null
* @param prefixMatcher the prefix for variables, not null
@@ -398,7 +396,6 @@ public class StrSubstitutor {
this.setValueDelimiterMatcher(valueDelimiterMatcher);
}
- //-----------------------------------------------------------------------
/**
* Replaces all the occurrences of variables with their matching values
* from the resolver using the given source string as a template.
@@ -423,6 +420,7 @@ public class StrSubstitutor {
* <p>
* Only the specified portion of the string will be processed.
* The rest of the string is not processed, and is not returned.
+ * </p>
*
* @param source the string to replace in, null returns null
* @param offset the start offset within the array, must be valid
@@ -440,7 +438,6 @@ public class StrSubstitutor {
return buf.toString();
}
- //-----------------------------------------------------------------------
/**
* Replaces all the occurrences of variables with their matching values
* from the resolver using the given source array as a template.
@@ -465,6 +462,7 @@ public class StrSubstitutor {
* <p>
* Only the specified portion of the array will be processed.
* The rest of the array is not processed, and is not returned.
+ * </p>
*
* @param source the character array to replace in, not altered, null returns null
* @param offset the start offset within the array, must be valid
@@ -480,7 +478,6 @@ public class StrSubstitutor {
return buf.toString();
}
- //-----------------------------------------------------------------------
/**
* Replaces all the occurrences of variables with their matching values
* from the resolver using the given source buffer as a template.
@@ -505,6 +502,7 @@ public class StrSubstitutor {
* <p>
* Only the specified portion of the buffer will be processed.
* The rest of the buffer is not processed, and is not returned.
+ * </p>
*
* @param source the buffer to use as a template, not changed, null returns null
* @param offset the start offset within the array, must be valid
@@ -542,6 +540,7 @@ public class StrSubstitutor {
* <p>
* Only the specified portion of the buffer will be processed.
* The rest of the buffer is not processed, and is not returned.
+ * </p>
*
* @param source the buffer to use as a template, not changed, null returns null
* @param offset the start offset within the array, must be valid
@@ -557,7 +556,6 @@ public class StrSubstitutor {
return buf.toString();
}
- //-----------------------------------------------------------------------
/**
* Replaces all the occurrences of variables with their matching values
* from the resolver using the given source builder as a template.
@@ -582,6 +580,7 @@ public class StrSubstitutor {
* <p>
* Only the specified portion of the builder will be processed.
* The rest of the builder is not processed, and is not returned.
+ * </p>
*
* @param source the builder to use as a template, not changed, null returns null
* @param offset the start offset within the array, must be valid
@@ -597,7 +596,6 @@ public class StrSubstitutor {
return buf.toString();
}
- //-----------------------------------------------------------------------
/**
* Replaces all the occurrences of variables in the given source object with
* their matching values from the resolver. The input source object is
@@ -615,7 +613,6 @@ public class StrSubstitutor {
return buf.toString();
}
- //-----------------------------------------------------------------------
/**
* Replaces all the occurrences of variables within the given source buffer
* with their matching values from the resolver.
@@ -638,6 +635,7 @@ public class StrSubstitutor {
* <p>
* Only the specified portion of the buffer will be processed.
* The rest of the buffer is not processed, but it is not deleted.
+ * </p>
*
* @param source the buffer to replace in, updated, null returns zero
* @param offset the start offset within the array, must be valid
@@ -656,7 +654,6 @@ public class StrSubstitutor {
return true;
}
- //-----------------------------------------------------------------------
/**
* Replaces all the occurrences of variables within the given source buffer
* with their matching values from the resolver.
@@ -679,6 +676,7 @@ public class StrSubstitutor {
* <p>
* Only the specified portion of the buffer will be processed.
* The rest of the buffer is not processed, but it is not deleted.
+ * </p>
*
* @param source the buffer to replace in, updated, null returns zero
* @param offset the start offset within the array, must be valid
@@ -697,7 +695,6 @@ public class StrSubstitutor {
return true;
}
- //-----------------------------------------------------------------------
/**
* Replaces all the occurrences of variables within the given source
* builder with their matching values from the resolver.
@@ -718,6 +715,7 @@ public class StrSubstitutor {
* <p>
* Only the specified portion of the builder will be processed.
* The rest of the builder is not processed, but it is not deleted.
+ * </p>
*
* @param source the builder to replace in, null returns zero
* @param offset the start offset within the array, must be valid
@@ -731,15 +729,16 @@ public class StrSubstitutor {
return substitute(source, offset, length);
}
- //-----------------------------------------------------------------------
/**
* Internal method that substitutes the variables.
* <p>
* Most users of this class do not need to call this method. This method will
* be called automatically by another (public) method.
+ * </p>
* <p>
* Writers of subclasses can override this method if they need access to
* the substitution process at the start or end.
+ * </p>
*
* @param buf the string builder to substitute into, not null
* @param offset the start offset within the builder, must be valid
@@ -931,11 +930,13 @@ public class StrSubstitutor {
* <p>
* Most users of this class do not need to call this method. This method is
* called automatically by the substitution process.
+ * </p>
* <p>
* Writers of subclasses can override this method if they need to alter
* how each substitution occurs. The method is passed the variable's name
* and must return the corresponding value. This implementation uses the
* {@link #getVariableResolver()} with the variable's name as the key.
+ * </p>
*
* @param variableName the name of the variable, not null
* @param buf the buffer where the substitution is occurring, not null
@@ -954,8 +955,6 @@ public class StrSubstitutor {
return resolver.lookup(variableName);
}
- // Escape
- //-----------------------------------------------------------------------
/**
* Returns the escape character.
*
@@ -976,14 +975,13 @@ public class StrSubstitutor {
this.escapeChar = escapeCharacter;
}
- // Prefix
- //-----------------------------------------------------------------------
/**
* Gets the variable prefix matcher currently in use.
* <p>
* The variable prefix is the character or characters that identify the
* start of a variable. This prefix is expressed in terms of a matcher
* allowing advanced prefix matches.
+ * </p>
*
* @return The prefix matcher in use
*/
@@ -997,6 +995,7 @@ public class StrSubstitutor {
* The variable prefix is the character or characters that identify the
* start of a variable. This prefix is expressed in terms of a matcher
* allowing advanced prefix matches.
+ * </p>
*
* @param prefixMatcher the prefix matcher to use, null ignored
* @return this, to enable chaining
@@ -1014,6 +1013,7 @@ public class StrSubstitutor {
* The variable prefix is the character or characters that identify the
* start of a variable. This method allows a single character prefix to
* be easily set.
+ * </p>
*
* @param prefix the prefix character to use
* @return this, to enable chaining
@@ -1027,6 +1027,7 @@ public class StrSubstitutor {
* <p>
* The variable prefix is the character or characters that identify the
* start of a variable. This method allows a string prefix to be easily set.
+ * </p>
*
* @param prefix the prefix for variables, not null
* @return this, to enable chaining
@@ -1037,14 +1038,13 @@ public class StrSubstitutor {
return setVariablePrefixMatcher(StrMatcher.stringMatcher(prefix));
}
- // Suffix
- //-----------------------------------------------------------------------
/**
* Gets the variable suffix matcher currently in use.
* <p>
* The variable suffix is the character or characters that identify the
* end of a variable. This suffix is expressed in terms of a matcher
* allowing advanced suffix matches.
+ * </p>
*
* @return The suffix matcher in use
*/
@@ -1058,6 +1058,7 @@ public class StrSubstitutor {
* The variable suffix is the character or characters that identify the
* end of a variable. This suffix is expressed in terms of a matcher
* allowing advanced suffix matches.
+ * </p>
*
* @param suffixMatcher the suffix matcher to use, null ignored
* @return this, to enable chaining
@@ -1075,6 +1076,7 @@ public class StrSubstitutor {
* The variable suffix is the character or characters that identify the
* end of a variable. This method allows a single character suffix to
* be easily set.
+ * </p>
*
* @param suffix the suffix character to use
* @return this, to enable chaining
@@ -1088,6 +1090,7 @@ public class StrSubstitutor {
* <p>
* The variable suffix is the character or characters that identify the
* end of a variable. This method allows a string suffix to be easily set.
+ * </p>
*
* @param suffix the suffix for variables, not null
* @return this, to enable chaining
@@ -1098,16 +1101,16 @@ public class StrSubstitutor {
return setVariableSuffixMatcher(StrMatcher.stringMatcher(suffix));
}
- // Variable Default Value Delimiter
- //-----------------------------------------------------------------------
/**
* Gets the variable default value delimiter matcher currently in use.
* <p>
* The variable default value delimiter is the character or characters that delimit the
* variable name and the variable default value. This delimiter is expressed in terms of a matcher
* allowing advanced variable default value delimiter matches.
+ * </p>
* <p>
* If it returns null, then the variable default value resolution is disabled.
+ * </p>
*
* @return The variable default value delimiter matcher in use, may be null
*/
@@ -1121,9 +1124,11 @@ public class StrSubstitutor {
* The variable default value delimiter is the character or characters that delimit the
* variable name and the variable default value. This delimiter is expressed in terms of a matcher
* allowing advanced variable default value delimiter matches.
+ * </p>
* <p>
* If the {@code valueDelimiterMatcher} is null, then the variable default value resolution
* becomes disabled.
+ * </p>
*
* @param valueDelimiterMatcher variable default value delimiter matcher to use, may be null
* @return this, to enable chaining
@@ -1139,6 +1144,7 @@ public class StrSubstitutor {
* The variable default value delimiter is the character or characters that delimit the
* variable name and the variable default value. This method allows a single character
* variable default value delimiter to be easily set.
+ * </p>
*
* @param valueDelimiter the variable default value delimiter character to use
* @return this, to enable chaining
@@ -1153,9 +1159,11 @@ public class StrSubstitutor {
* The variable default value delimiter is the character or characters that delimit the
* variable name and the variable default value. This method allows a string
* variable default value delimiter to be easily set.
+ * </p>
* <p>
* If the {@code valueDelimiter} is null or empty string, then the variable default
* value resolution becomes disabled.
+ * </p>
*
* @param valueDelimiter the variable default value delimiter string to use, may be null or empty
* @return this, to enable chaining
@@ -1168,8 +1176,6 @@ public class StrSubstitutor {
return setValueDelimiterMatcher(StrMatcher.stringMatcher(valueDelimiter));
}
- // Resolver
- //-----------------------------------------------------------------------
/**
* Gets the VariableResolver that is used to lookup variables.
*
@@ -1188,8 +1194,6 @@ public class StrSubstitutor {
this.variableResolver = variableResolver;
}
- // Substitution support in variable names
- //-----------------------------------------------------------------------
/**
* Returns a flag whether substitution is done in variable names.
*
diff --git a/src/main/java/org/apache/commons/text/StrTokenizer.java b/src/main/java/org/apache/commons/text/StrTokenizer.java
index 3f84920..024ed17 100644
--- a/src/main/java/org/apache/commons/text/StrTokenizer.java
+++ b/src/main/java/org/apache/commons/text/StrTokenizer.java
@@ -88,8 +88,10 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
/** Comma separated values tokenizer internal variable. */
private static final StrTokenizer CSV_TOKENIZER_PROTOTYPE;
+
/** Tab separated values tokenizer internal variable. */
private static final StrTokenizer TSV_TOKENIZER_PROTOTYPE;
+
static {
CSV_TOKENIZER_PROTOTYPE = new StrTokenizer();
CSV_TOKENIZER_PROTOTYPE.setDelimiterMatcher(StrMatcher.commaMatcher());
@@ -116,6 +118,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
private static StrTokenizer getCSVClone() {
return (StrTokenizer) CSV_TOKENIZER_PROTOTYPE.clone();
}
+
/**
* Gets a new tokenizer instance which parses Comma Separated Value strings
* initializing it with the given input. The default for CSV processing
@@ -123,11 +126,13 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* the setTrimmer method).
* <p>
* You must call a "reset" method to set the string which you want to parse.
+ * </p>
* @return a new tokenizer instance which parses Comma Separated Value strings
*/
public static StrTokenizer getCSVInstance() {
return getCSVClone();
}
+
/**
* Gets a new tokenizer instance which parses Comma Separated Value strings
* initializing it with the given input. The default for CSV processing
@@ -165,6 +170,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
private static StrTokenizer getTSVClone() {
return (StrTokenizer) TSV_TOKENIZER_PROTOTYPE.clone();
}
+
/**
* Gets a new tokenizer instance which parses Tab Separated Value strings.
* The default for CSV processing will be trim whitespace from both ends
@@ -172,10 +178,12 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* <p>
* You must call a "reset" method to set the string which you want to parse.
* @return a new tokenizer instance which parses Tab Separated Value strings.
+ * </p>
*/
public static StrTokenizer getTSVInstance() {
return getTSVClone();
}
+
/**
* Gets a new tokenizer instance which parses Tab Separated Value strings.
* The default for CSV processing will be trim whitespace from both ends
@@ -201,11 +209,10 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
tok.reset(input);
return tok;
}
+
/** The text to work on. */
private char[] chars;
- //-----------------------------------------------------------------------
-
/** The parsed tokens. */
private String[] tokens;
@@ -221,7 +228,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
/** The ignored matcher. */
private StrMatcher ignoredMatcher = StrMatcher.noneMatcher();
-
/** The trimmer matcher. */
private StrMatcher trimmerMatcher = StrMatcher.noneMatcher();
@@ -231,12 +237,12 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
/** Whether to ignore empty tokens. */
private boolean ignoreEmptyTokens = true;
- //-----------------------------------------------------------------------
/**
* Constructs a tokenizer splitting on space, tab, newline and form feed
* as per StringTokenizer, but with no text to tokenize.
* <p>
* This constructor is normally used with {@link #reset(String)}.
+ * </p>
*/
public StrTokenizer() {
this.chars = null;
@@ -416,8 +422,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
list.add(tok);
}
- // Implementation
- //-----------------------------------------------------------------------
/**
* Checks if tokenization has been done, and if not then do it.
*/
@@ -434,7 +438,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
}
}
- //-----------------------------------------------------------------------
/**
* Creates a new instance of this Tokenizer. The new instance is reset so
* that it will be at the start of the token list.
@@ -468,7 +471,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return cloned;
}
- //-----------------------------------------------------------------------
/**
* Gets the String content that the tokenizer is parsing.
*
@@ -481,8 +483,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return new String(chars);
}
- // Delimiter
- //-----------------------------------------------------------------------
/**
* Gets the field delimiter matcher.
*
@@ -492,14 +492,13 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return this.delimMatcher;
}
- // Ignored
- //-----------------------------------------------------------------------
/**
* Gets the ignored character matcher.
* <p>
* These characters are ignored when parsing the String, unless they are
* within a quoted region.
* The default value is not to ignore anything.
+ * </p>
*
* @return The ignored matcher in use
*/
@@ -507,14 +506,13 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return ignoredMatcher;
}
- // Quote
- //-----------------------------------------------------------------------
/**
* Gets the quote matcher currently in use.
* <p>
* The quote character is used to wrap data between the tokens.
* This enables delimiters to be entered as data.
* The default value is '"' (double quote).
+ * </p>
*
* @return The quote matcher in use
*/
@@ -545,14 +543,13 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return list;
}
- // Trimmer
- //-----------------------------------------------------------------------
/**
* Gets the trimmer character matcher.
* <p>
* These characters are trimmed off on each side of the delimiter
* until the token or quote is found.
* The default value is not to trim anything.
+ * </p>
*
* @return The trimmer matcher in use
*/
@@ -560,8 +557,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return trimmerMatcher;
}
- // ListIterator
- //-----------------------------------------------------------------------
/**
* Checks whether there are any more tokens.
*
@@ -584,7 +579,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return tokenPos > 0;
}
- //-----------------------------------------------------------------------
/**
* Gets whether the tokenizer currently returns empty tokens as null.
* The default for this property is false.
@@ -595,7 +589,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return this.emptyAsNull;
}
- //-----------------------------------------------------------------------
/**
* Gets whether the tokenizer currently ignores empty tokens.
* The default for this property is true.
@@ -932,6 +925,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* Sets the field delimiter matcher.
* <p>
* The delimiter is used to separate one token from another.
+ * </p>
*
* @param delim the delimiter matcher to use
* @return this, to enable chaining
@@ -972,6 +966,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* <p>
* This character is ignored when parsing the String, unless it is
* within a quoted region.
+ * </p>
*
* @param ignored the ignored character to use
* @return this, to enable chaining
@@ -985,6 +980,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* <p>
* These characters are ignored when parsing the String, unless they are
* within a quoted region.
+ * </p>
*
* @param ignored the ignored matcher to use, null ignored
* @return this, to enable chaining
@@ -1013,6 +1009,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* <p>
* The quote character is used to wrap data between the tokens.
* This enables delimiters to be entered as data.
+ * </p>
*
* @param quote the quote character to use
* @return this, to enable chaining
@@ -1026,6 +1023,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* <p>
* The quote character is used to wrap data between the tokens.
* This enables delimiters to be entered as data.
+ * </p>
*
* @param quote the quote matcher to use, null ignored
* @return this, to enable chaining
@@ -1042,6 +1040,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* <p>
* These characters are trimmed off on each side of the delimiter
* until the token or quote is found.
+ * </p>
*
* @param trimmer the trimmer matcher to use, null ignored
* @return this, to enable chaining
@@ -1053,8 +1052,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return this;
}
- // API
- //-----------------------------------------------------------------------
/**
* Gets the number of tokens found in the String.
*
@@ -1070,15 +1067,18 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
* <p>
* Most users of this class do not need to call this method. This method
* will be called automatically by other (public) methods when required.
+ * </p>
* <p>
* This method exists to allow subclasses to add code before or after the
* tokenization. For example, a subclass could alter the character array,
* offset or count to be parsed, or call the tokenizer multiple times on
* multiple strings. It is also be possible to filter the results.
+ * </p>
* <p>
* {@code StrTokenizer} will always pass a zero offset and a count
* equal to the length of the array to this method, however a subclass
* may pass other values, or even an entirely different array.
+ * </p>
*
* @param srcChars the character array being tokenized, may be null
* @param offset the start position within the character array, must be valid
@@ -1106,7 +1106,6 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
return tokenList;
}
- //-----------------------------------------------------------------------
/**
* Gets the String content that the tokenizer is parsing.
*
diff --git a/src/main/java/org/apache/commons/text/StringEscapeUtils.java b/src/main/java/org/apache/commons/text/StringEscapeUtils.java
index 7daaace..786915d 100644
--- a/src/main/java/org/apache/commons/text/StringEscapeUtils.java
+++ b/src/main/java/org/apache/commons/text/StringEscapeUtils.java
@@ -410,8 +410,8 @@ public class StringEscapeUtils {
/* Helper functions */
/**
- * <p>{@code StringEscapeUtils} instances should NOT be constructed in
- * standard programming.</p>
+ * {@code StringEscapeUtils} instances should NOT be constructed in
+ * standard programming.
*
* <p>Instead, the class should be used as:</p>
* <pre>StringEscapeUtils.escapeJava("foo");</pre>
@@ -423,7 +423,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods.</p>
+ * Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods.
*
* <p>Example:</p>
* <pre>
@@ -460,7 +460,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Escape {@code input} according to the given {@link CharSequenceTranslator}.</p>
+ * Escape {@code input} according to the given {@link CharSequenceTranslator}.
*
* @param input the String to escape
* @return {@code this}, to enable chaining
@@ -482,7 +482,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Return the escaped string.</p>
+ * Return the escaped string.
*
* @return The escaped string
*/
@@ -504,7 +504,7 @@ public class StringEscapeUtils {
// Java and JavaScript
//--------------------------------------------------------------------------
/**
- * <p>Escapes the characters in a {@code String} using Java String rules.</p>
+ * Escapes the characters in a {@code String} using Java String rules.
*
* <p>Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.) </p>
*
@@ -528,7 +528,8 @@ public class StringEscapeUtils {
}
/**
- * <p>Escapes the characters in a {@code String} using EcmaScript String rules.</p>
+ * Escapes the characters in a {@code String} using EcmaScript String rules.
+ *
* <p>Escapes any values it finds into their EcmaScript String form.
* Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.) </p>
*
@@ -561,7 +562,8 @@ public class StringEscapeUtils {
}
/**
- * <p>Escapes the characters in a {@code String} using Json String rules.</p>
+ * Escapes the characters in a {@code String} using Json String rules.
+ *
* <p>Escapes any values it finds into their Json String form.
* Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.) </p>
*
@@ -587,10 +589,10 @@ public class StringEscapeUtils {
}
/**
- * <p>Unescapes any Java literals found in the {@code String}.
+ * Unescapes any Java literals found in the {@code String}.
* For example, it will turn a sequence of {@code '\'} and
* {@code 'n'} into a newline character, unless the {@code '\'}
- * is preceded by another {@code '\'}.</p>
+ * is preceded by another {@code '\'}.
*
* @param input the {@code String} to unescape, may be null
* @return a new unescaped {@code String}, {@code null} if null string input
@@ -600,7 +602,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Unescapes any EcmaScript literals found in the {@code String}.</p>
+ * Unescapes any EcmaScript literals found in the {@code String}.
*
* <p>For example, it will turn a sequence of {@code '\'} and {@code 'n'}
* into a newline character, unless the {@code '\'} is preceded by another
@@ -615,7 +617,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Unescapes any Json literals found in the {@code String}.</p>
+ * Unescapes any Json literals found in the {@code String}.
*
* <p>For example, it will turn a sequence of {@code '\'} and {@code 'n'}
* into a newline character, unless the {@code '\'} is preceded by another
@@ -632,7 +634,7 @@ public class StringEscapeUtils {
// HTML and XML
//--------------------------------------------------------------------------
/**
- * <p>Escapes the characters in a {@code String} using HTML entities.</p>
+ * Escapes the characters in a {@code String} using HTML entities.
*
* <p>
* For example:
@@ -661,7 +663,8 @@ public class StringEscapeUtils {
}
/**
- * <p>Escapes the characters in a {@code String} using HTML entities.</p>
+ * Escapes the characters in a {@code String} using HTML entities.
+ *
* <p>Supports only the HTML 3.0 entities.</p>
*
* @param input the {@code String} to escape, may be null
@@ -671,11 +674,10 @@ public class StringEscapeUtils {
return ESCAPE_HTML3.translate(input);
}
- //-----------------------------------------------------------------------
/**
- * <p>Unescapes a string containing entity escapes to a string
+ * Unescapes a string containing entity escapes to a string
* containing the actual Unicode characters corresponding to the
- * escapes. Supports HTML 4.0 entities.</p>
+ * escapes. Supports HTML 4.0 entities.
*
* <p>For example, the string {@code "<Français>"}
* will become {@code "<Fran�ais>"}</p>
@@ -692,9 +694,9 @@ public class StringEscapeUtils {
}
/**
- * <p>Unescapes a string containing entity escapes to a string
+ * Unescapes a string containing entity escapes to a string
* containing the actual Unicode characters corresponding to the
- * escapes. Supports only HTML 3.0 entities.</p>
+ * escapes. Supports only HTML 3.0 entities.
*
* @param input the {@code String} to unescape, may be null
* @return a new unescaped {@code String}, {@code null} if null string input
@@ -704,7 +706,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Escapes the characters in a {@code String} using XML entities.</p>
+ * Escapes the characters in a {@code String} using XML entities.
*
* <p>For example: {@code "bread" & "butter"} =>
* {@code "bread" & "butter"}.
@@ -735,7 +737,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Escapes the characters in a {@code String} using XML entities.</p>
+ * Escapes the characters in a {@code String} using XML entities.
*
* <p>For example: {@code "bread" & "butter"} =>
* {@code "bread" & "butter"}.
@@ -763,11 +765,10 @@ public class StringEscapeUtils {
return ESCAPE_XML11.translate(input);
}
- //-----------------------------------------------------------------------
/**
- * <p>Unescapes a string containing XML entity escapes to a string
+ * Unescapes a string containing XML entity escapes to a string
* containing the actual Unicode characters corresponding to the
- * escapes.</p>
+ * escapes.
*
* <p>Supports only the five basic XML entities (gt, lt, quot, amp, apos).
* Does not support DTDs or external entities.</p>
@@ -784,11 +785,9 @@ public class StringEscapeUtils {
return UNESCAPE_XML.translate(input);
}
- //-----------------------------------------------------------------------
-
/**
- * <p>Returns a {@code String} value for a CSV column enclosed in double quotes,
- * if required.</p>
+ * Returns a {@code String} value for a CSV column enclosed in double quotes,
+ * if required.
*
* <p>If the value contains a comma, newline or double quote, then the
* String value is returned enclosed in double quotes.</p>
@@ -810,7 +809,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Returns a {@code String} value for an unescaped CSV column.</p>
+ * Returns a {@code String} value for an unescaped CSV column.
*
* <p>If the value is enclosed in double quotes, and contains a comma, newline
* or double quote, then quotes are removed.
@@ -834,7 +833,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Escapes the characters in a {@code String} using XSI rules.</p>
+ * Escapes the characters in a {@code String} using XSI rules.
*
* <p><b>Beware!</b> In most cases you don't want to escape shell commands but use multi-argument
* methods provided by {@link java.lang.ProcessBuilder} or {@link java.lang.Runtime#exec(String[])}
@@ -855,7 +854,7 @@ public class StringEscapeUtils {
}
/**
- * <p>Unescapes the characters in a {@code String} using XSI rules.</p>
+ * Unescapes the characters in a {@code String} using XSI rules.
*
* @see StringEscapeUtils#escapeXSI(String)
* @param input the {@code String} to unescape, may be null
diff --git a/src/main/java/org/apache/commons/text/StringTokenizer.java b/src/main/java/org/apache/commons/text/StringTokenizer.java
index 14f1764..731c468 100644
--- a/src/main/java/org/apache/commons/text/StringTokenizer.java
+++ b/src/main/java/org/apache/commons/text/StringTokenizer.java
@@ -95,8 +95,10 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
/** Comma separated values tokenizer internal variable. */
private static final StringTokenizer CSV_TOKENIZER_PROTOTYPE;
+
/** Tab separated values tokenizer internal variable. */
private static final StringTokenizer TSV_TOKENIZER_PROTOTYPE;
+
static {
CSV_TOKENIZER_PROTOTYPE = new StringTokenizer();
CSV_TOKENIZER_PROTOTYPE.setDelimiterMatcher(StringMatcherFactory.INSTANCE.commaMatcher());
@@ -123,6 +125,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
private static StringTokenizer getCSVClone() {
return (StringTokenizer) CSV_TOKENIZER_PROTOTYPE.clone();
}
+
/**
* Gets a new tokenizer instance which parses Comma Separated Value strings initializing it with the given input.
* The default for CSV processing will be trim whitespace from both ends (which can be overridden with the
@@ -136,6 +139,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
public static StringTokenizer getCSVInstance() {
return getCSVClone();
}
+
/**
* Gets a new tokenizer instance which parses Comma Separated Value strings initializing it with the given input.
* The default for CSV processing will be trim whitespace from both ends (which can be overridden with the
@@ -161,6 +165,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
public static StringTokenizer getCSVInstance(final String input) {
return getCSVClone().reset(input);
}
+
/**
* Returns a clone of {@code TSV_TOKENIZER_PROTOTYPE}.
*
@@ -169,6 +174,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
private static StringTokenizer getTSVClone() {
return (StringTokenizer) TSV_TOKENIZER_PROTOTYPE.clone();
}
+
/**
* Gets a new tokenizer instance which parses Tab Separated Value strings. The default for CSV processing will be
* trim whitespace from both ends (which can be overridden with the setTrimmer method).
@@ -181,6 +187,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
public static StringTokenizer getTSVInstance() {
return getTSVClone();
}
+
/**
* Gets a new tokenizer instance which parses Tab Separated Value strings. The default for CSV processing will be
* trim whitespace from both ends (which can be overridden with the setTrimmer method).
@@ -204,6 +211,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
public static StringTokenizer getTSVInstance(final String input) {
return getTSVClone().reset(input);
}
+
/** The text to work on. */
private char[] chars;
@@ -567,7 +575,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Checks whether there are any more tokens.
+ * Tests whether there are any more tokens.
*
* @return true if there are more tokens
*/
@@ -578,7 +586,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Checks whether there are any previous tokens that can be iterated to.
+ * Tests whether there are any previous tokens that can be iterated to.
*
* @return true if there are previous tokens
*/
@@ -589,7 +597,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Gets whether the tokenizer currently returns empty tokens as null. The default for this property is false.
+ * Tests whether the tokenizer currently returns empty tokens as null. The default for this property is false.
*
* @return true if empty tokens are returned as null
*/
@@ -598,7 +606,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Gets whether the tokenizer currently ignores empty tokens. The default for this property is true.
+ * Tests whether the tokenizer currently ignores empty tokens. The default for this property is true.
*
* @return true if empty tokens are not returned
*/
@@ -607,7 +615,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Checks if the characters at the index specified match the quote already matched in readNextToken().
+ * Tests if the characters at the index specified match the quote already matched in readNextToken().
*
* @param srcChars
* the character array being tokenized
@@ -856,7 +864,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Unsupported ListIterator operation.
+ * Throws {@link UnsupportedOperationException} for this unsupported ListIterator operation.
*
* @throws UnsupportedOperationException
* always
@@ -870,6 +878,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
* Resets this tokenizer, forgetting all parsing and iteration already completed.
* <p>
* This method allows the same tokenizer to be reused for the same String.
+ * </p>
*
* @return this, to enable chaining
*/
@@ -880,7 +889,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Reset this tokenizer, giving it a new input string to parse. In this manner you can re-use a tokenizer with the
+ * Resets this tokenizer, giving it a new input string to parse. In this manner you can re-use a tokenizer with the
* same settings on multiple input lines.
*
* @param input
@@ -894,7 +903,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Reset this tokenizer, giving it a new input string to parse. In this manner you can re-use a tokenizer with the
+ * Resets this tokenizer, giving it a new input string to parse. In this manner you can re-use a tokenizer with the
* same settings on multiple input lines.
*
* @param input
@@ -908,7 +917,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Unsupported ListIterator operation.
+ * Throws {@link UnsupportedOperationException} for this unsupported ListIterator operation.
*
* @param obj
* this parameter ignored.
@@ -970,7 +979,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Set the character to ignore.
+ * Sets the character to ignore.
* <p>
* This character is ignored when parsing the String, unless it is within a quoted region.
* </p>
@@ -984,7 +993,7 @@ public class StringTokenizer implements ListIterator<String>, Cloneable {
}
/**
- * Set the matcher for characters to ignore.
+ * Sets the matcher for characters to ignore.
* <p>
* These characters are ignored when parsing the String, unless they are within a quoted region.
* </p>
diff --git a/src/main/java/org/apache/commons/text/TextRandomProvider.java b/src/main/java/org/apache/commons/text/TextRandomProvider.java
index e0d5fb3..268b23b 100644
--- a/src/main/java/org/apache/commons/text/TextRandomProvider.java
+++ b/src/main/java/org/apache/commons/text/TextRandomProvider.java
@@ -17,12 +17,10 @@
package org.apache.commons.text;
/**
- * <p>
* TextRandomProvider implementations are used by {@link RandomStringGenerator}
* as a source of randomness. It is highly recommended that the
* <a href="https://commons.apache.org/proper/commons-rng/">Apache Commons RNG</a>
* library be used to provide the random number generation.
- * </p>
*
* <p>
* When using Java 8 or later, TextRandomProvider is a functional interface and
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index e8aae03..5179612 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -325,7 +325,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
private int size;
/**
- * Constructor that creates an empty builder initial capacity 32 characters.
+ * Constructs an empty builder initial capacity 32 characters.
*/
public TextStringBuilder() {
this(CAPACITY);
@@ -1002,7 +1002,6 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
return append(value).appendNewLine();
}
- // -----------------------------------------------------------------------
/**
* Appends an object followed by a new line to this string builder. Appending null will call {@link #appendNull()}.
*
@@ -1125,6 +1124,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
* <p>
* The new line string can be altered using {@link #setNewLineText(String)}. This might be used to force the output
* to always use Unix line endings even when on Windows.
+ * </p>
*
* @return this, to enable chaining
*/
@@ -1193,7 +1193,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
}
/**
- * Append one of both separators to the builder If the builder is currently empty it will append the
+ * Appends one of both separators to the builder If the builder is currently empty it will append the
* defaultIfEmpty-separator Otherwise it will append the standard-separator
*
* The separator is appended using {@link #append(char)}.
@@ -1425,7 +1425,6 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
return this;
}
- // -----------------------------------------------------------------------
/**
* Gets the contents of this builder as a Reader.
* <p>
@@ -1566,7 +1565,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
}
/**
- * Checks if the string builder contains the specified char.
+ * Tests if the string builder contains the specified char.
*
* @param ch the character to find
* @return true if the builder contains the character
@@ -1582,7 +1581,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
}
/**
- * Checks if the string builder contains the specified string.
+ * Tests if the string builder contains the specified string.
*
* @param str the string to find
* @return true if the builder contains the string
@@ -1592,7 +1591,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
}
/**
- * Checks if the string builder contains a string matched using the specified matcher.
+ * Tests if the string builder contains a string matched using the specified matcher.
* <p>
* Matchers can be used to perform advanced searching behavior. For example you could write a matcher to search for
* the character 'a' followed by a number.
@@ -1668,6 +1667,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
* <p>
* Matchers can be used to perform advanced deletion behavior. For example you could write a matcher to delete all
* occurrences where the character 'a' is followed by a number.
+ * </p>
*
* @param matcher the matcher to use to find the deletion, null causes no action
* @return this, to enable chaining
@@ -1729,6 +1729,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
* <p>
* Matchers can be used to perform advanced deletion behavior. For example you could write a matcher to delete where
* the character 'a' is followed by a number.
+ * </p>
*
* @param matcher the matcher to use to find the deletion, null causes no action
* @return this, to enable chaining
@@ -1819,7 +1820,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
}
/**
- * Checks the capacity and ensures that it is at least the size specified.
+ * Tests the capacity and ensures that it is at least the size specified.
*
* @param capacity the capacity to ensure
* @return this, to enable chaining
@@ -1832,7 +1833,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
}
/**
- * Checks the contents of this builder against another to see if they contain the same character content.
+ * Tests the contents of this builder against another to see if they contain the same character content.
*
* @param obj the object to check, null returns false
* @return true if the builders contain the same characters in the same order
@@ -1843,7 +1844,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
}
/**
- * Checks the contents of this builder against another to see if they contain the same character content.
+ * Tests the contents of this builder against another to see if they contain the same character content.
*
* @param other the object to check, null returns false
* @return true if the builders contain the same characters in the same order
@@ -1853,7 +1854,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
}
/**
- * Checks the contents of this builder against another to see if they contain the same character content ignoring
+ * Tests the contents of this builder against another to see if they contain the same character content ignoring
* case.
*
* @param other the object to check, null returns false
@@ -1984,6 +1985,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
* Searches the string builder to find the first reference to the specified string.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
+ * </p>
*
* @param str the string to find, null returns -1
* @return The first index of the string, or -1 if not found
@@ -2322,6 +2324,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
* Searches the string builder to find the last reference to the specified string.
* <p>
* Note that a null input string will return -1, whereas the JDK throws an exception.
+ * </p>
*
* @param str the string to find, null returns -1
* @return The last index of the string, or -1 if not found
@@ -3026,6 +3029,7 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
* Gets a String version of the string builder, creating a new instance each time the method is called.
* <p>
* Note that unlike StringBuffer, the string version returned is independent of the string builder.
+ * </p>
*
* @return The builder as a String
*/
diff --git a/src/main/java/org/apache/commons/text/WordUtils.java b/src/main/java/org/apache/commons/text/WordUtils.java
index dd4b448..6511e4c 100644
--- a/src/main/java/org/apache/commons/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/text/WordUtils.java
@@ -26,9 +26,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
/**
- * <p>
* Operations on Strings that contain words.
- * </p>
*
* <p>
* This class tries to handle {@code null} input gracefully. An exception will not be thrown for a
@@ -40,9 +38,9 @@ import org.apache.commons.lang3.Validate;
public class WordUtils {
/**
- * <p>{@code WordUtils} instances should NOT be constructed in
+ * {@code WordUtils} instances should NOT be constructed in
* standard programming. Instead, the class should be used as
- * {@code WordUtils.wrap("foo bar", 20);}.</p>
+ * {@code WordUtils.wrap("foo bar", 20);}.
*
* <p>This constructor is public to permit tools that require a JavaBean
* instance to operate.</p>
@@ -50,10 +48,8 @@ public class WordUtils {
public WordUtils() {
}
- // Wrapping
- //--------------------------------------------------------------------------
/**
- * <p>Wraps a single line of text, identifying words by {@code ' '}.</p>
+ * Wraps a single line of text, identifying words by {@code ' '}.
*
* <p>New lines will be separated by the system property line separator.
* Very long words, such as URLs will <i>not</i> be wrapped.</p>
@@ -106,7 +102,7 @@ public class WordUtils {
}
/**
- * <p>Wraps a single line of text, identifying words by {@code ' '}.</p>
+ * Wraps a single line of text, identifying words by {@code ' '}.
*
* <p>Leading spaces on a new line are stripped.
* Trailing spaces are not stripped.</p>
@@ -188,7 +184,7 @@ public class WordUtils {
}
/**
- * <p>Wraps a single line of text, identifying words by {@code wrapOn}.</p>
+ * Wraps a single line of text, identifying words by {@code wrapOn}.
*
* <p>Leading spaces on a new line are stripped.
* Trailing spaces are not stripped.</p>
@@ -381,13 +377,11 @@ public class WordUtils {
return wrappedLine.toString();
}
- // Capitalizing
- //-----------------------------------------------------------------------
/**
- * <p>Capitalizes all the whitespace separated words in a String.
+ * Capitalizes all the whitespace separated words in a String.
* Only the first character of each word is changed. To convert the
* rest of each word to lowercase at the same time,
- * use {@link #capitalizeFully(String)}.</p>
+ * use {@link #capitalizeFully(String)}.
*
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.
* A {@code null} input String returns {@code null}.
@@ -410,10 +404,10 @@ public class WordUtils {
}
/**
- * <p>Capitalizes all the delimiter separated words in a String.
+ * Capitalizes all the delimiter separated words in a String.
* Only the first character of each word is changed. To convert the
* rest of each word to lowercase at the same time,
- * use {@link #capitalizeFully(String, char[])}.</p>
+ * use {@link #capitalizeFully(String, char[])}.
*
* <p>The delimiters represent a set of characters understood to separate words.
* The first string character and the first non-delimiter character after a
@@ -468,11 +462,10 @@ public class WordUtils {
return new String(newCodePoints, 0, outOffset);
}
- //-----------------------------------------------------------------------
/**
- * <p>Converts all the whitespace separated words in a String into capitalized words,
+ * Converts all the whitespace separated words in a String into capitalized words,
* that is each word is made up of a titlecase character and then a series of
- * lowercase characters.</p>
+ * lowercase characters.
*
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.
* A {@code null} input String returns {@code null}.
@@ -493,9 +486,9 @@ public class WordUtils {
}
/**
- * <p>Converts all the delimiter separated words in a String into capitalized words,
+ * Converts all the delimiter separated words in a String into capitalized words,
* that is each word is made up of a titlecase character and then a series of
- * lowercase characters.</p>
+ * lowercase characters.
*
* <p>The delimiters represent a set of characters understood to separate words.
* The first string character and the first non-delimiter character after a
@@ -525,10 +518,9 @@ public class WordUtils {
return capitalize(str, delimiters);
}
- //-----------------------------------------------------------------------
/**
- * <p>Uncapitalizes all the whitespace separated words in a String.
- * Only the first character of each word is changed.</p>
+ * Uncapitalizes all the whitespace separated words in a String.
+ * Only the first character of each word is changed.
*
* <p>Whitespace is defined by {@link Character#isWhitespace(char)}.
* A {@code null} input String returns {@code null}.</p>
@@ -548,8 +540,8 @@ public class WordUtils {
}
/**
- * <p>Uncapitalizes all the whitespace separated words in a String.
- * Only the first character of each word is changed.</p>
+ * Uncapitalizes all the whitespace separated words in a String.
+ * Only the first character of each word is changed.
*
* <p>The delimiters represent a set of characters understood to separate words.
* The first string character and the first non-delimiter character after a
@@ -602,9 +594,8 @@ public class WordUtils {
return new String(newCodePoints, 0, outOffset);
}
- //-----------------------------------------------------------------------
/**
- * <p>Swaps the case of a String using a word based algorithm.</p>
+ * Swaps the case of a String using a word based algorithm.
*
* <ul>
* <li>Upper case character converts to Lower case</li>
@@ -656,9 +647,8 @@ public class WordUtils {
return new String(newCodePoints, 0, outOffset);
}
- //-----------------------------------------------------------------------
/**
- * <p>Extracts the initial characters from each word in the String.</p>
+ * Extracts the initial characters from each word in the String.
*
* <p>All first characters after whitespace are returned as a new string.
* Their case is not changed.</p>
@@ -682,7 +672,7 @@ public class WordUtils {
}
/**
- * <p>Extracts the initial characters from each word in the String.</p>
+ * Extracts the initial characters from each word in the String.
*
* <p>All first characters after the defined delimiters are returned as a new string.
* Their case is not changed.</p>
@@ -733,9 +723,8 @@ public class WordUtils {
return new String(newCodePoints, 0, count);
}
- //-----------------------------------------------------------------------
/**
- * <p>Checks if the String contains all words in the given array.</p>
+ * Checks if the String contains all words in the given array.
*
* <p>
* A {@code null} String will return {@code false}. A {@code null}, zero
@@ -771,7 +760,6 @@ public class WordUtils {
return true;
}
- //-----------------------------------------------------------------------
/**
* Is the character a delimiter.
*
@@ -793,7 +781,6 @@ public class WordUtils {
return false;
}
- //-----------------------------------------------------------------------
/**
* Is the codePoint a delimiter.
*
@@ -816,14 +803,15 @@ public class WordUtils {
return false;
}
- //-----------------------------------------------------------------------
/**
* Abbreviates the words nicely.
*
+ * <p>
* This method searches for the first space after the lower limit and abbreviates
* the String there. It will also append any String passed as a parameter
* to the end of the String. The upper limit can be specified to forcibly
* abbreviate a String.
+ * </p>
*
* @param str the string to be abbreviated. If null is passed, null is returned.
* If the empty String is passed, the empty string is returned.
@@ -893,12 +881,9 @@ public class WordUtils {
return result.toString();
}
- // -----------------------------------------------------------------------
/**
- * <p>
* Converts an array of delimiters to a hash set of code points. Code point of space(32) is added as the default
* value if delimiters is null. The generated hash set provides O(1) lookup time.
- * </p>
*
* @param delimiters set of characters to determine capitalization, null means whitespace
* @return Set<Integer>
diff --git a/src/main/java/org/apache/commons/text/diff/CommandVisitor.java b/src/main/java/org/apache/commons/text/diff/CommandVisitor.java
index 7e5f40f..41a8697 100644
--- a/src/main/java/org/apache/commons/text/diff/CommandVisitor.java
+++ b/src/main/java/org/apache/commons/text/diff/CommandVisitor.java
@@ -69,6 +69,7 @@ package org.apache.commons.text.diff;
* <p>
* The second example is a visitor that shows the commands and the way
* they transform the first sequence into the second one:
+ * </p>
* <pre>
* import org.apache.commons.text.diff.CommandVisitor;
*
diff --git a/src/main/java/org/apache/commons/text/diff/DeleteCommand.java b/src/main/java/org/apache/commons/text/diff/DeleteCommand.java
index 69ed484..a8f91ea 100644
--- a/src/main/java/org/apache/commons/text/diff/DeleteCommand.java
+++ b/src/main/java/org/apache/commons/text/diff/DeleteCommand.java
@@ -35,7 +35,7 @@ package org.apache.commons.text.diff;
public class DeleteCommand<T> extends EditCommand<T> {
/**
- * Simple constructor. Creates a new instance of {@link DeleteCommand}.
+ * Constructs a new instance of {@link DeleteCommand}.
*
* @param object the object of the first sequence that should be deleted
*/
@@ -44,7 +44,7 @@ public class DeleteCommand<T> extends EditCommand<T> {
}
/**
- * Accept a visitor. When a {@code DeleteCommand} accepts a visitor, it calls
+ * Accepts a visitor. When a {@code DeleteCommand} accepts a visitor, it calls
* its {@link CommandVisitor#visitDeleteCommand visitDeleteCommand} method.
*
* @param visitor the visitor to be accepted
diff --git a/src/main/java/org/apache/commons/text/diff/EditCommand.java b/src/main/java/org/apache/commons/text/diff/EditCommand.java
index d262154..1d6f19f 100644
--- a/src/main/java/org/apache/commons/text/diff/EditCommand.java
+++ b/src/main/java/org/apache/commons/text/diff/EditCommand.java
@@ -57,7 +57,7 @@ public abstract class EditCommand<T> {
private final T object;
/**
- * Simple constructor. Creates a new instance of EditCommand
+ * Constructs a new instance of EditCommand
*
* @param object reference to the object associated with this command, this
* refers to an element of one of the sequences being compared
@@ -67,7 +67,7 @@ public abstract class EditCommand<T> {
}
/**
- * Returns the object associated with this command.
+ * Gets the object associated with this command.
*
* @return The object on which the command is applied
*/
@@ -80,6 +80,7 @@ public abstract class EditCommand<T> {
* <p>
* This method is invoked for each commands belonging to
* an {@link EditScript EditScript}, in order to implement the visitor design pattern
+ * </p>
*
* @param visitor the visitor to be accepted
*/
diff --git a/src/main/java/org/apache/commons/text/diff/EditScript.java b/src/main/java/org/apache/commons/text/diff/EditScript.java
index e179818..9e20c3c 100644
--- a/src/main/java/org/apache/commons/text/diff/EditScript.java
+++ b/src/main/java/org/apache/commons/text/diff/EditScript.java
@@ -27,6 +27,7 @@ import java.util.List;
* sequences. It is built as the result of the comparison between two sequences
* by the {@link StringsComparator StringsComparator} class. The user can
* walk through it using the <em>visitor</em> design pattern.
+ * </p>
* <p>
* It is guaranteed that the objects embedded in the {@link InsertCommand insert
* commands} come from the second sequence and that the objects embedded in
@@ -34,6 +35,7 @@ import java.util.List;
* commands} come from the first sequence. This can be important if subclassing
* is used for some elements in the first sequence and the {@code equals}
* method is specialized.
+ * </p>
*
* @see StringsComparator
* @see EditCommand
@@ -55,7 +57,7 @@ public class EditScript<T> {
private int modifications;
/**
- * Simple constructor. Creates a new empty script.
+ * Constructs a new empty script.
*/
public EditScript() {
commands = new ArrayList<>();
@@ -64,7 +66,7 @@ public class EditScript<T> {
}
/**
- * Add a keep command to the script.
+ * Appends a keep command to the script.
*
* @param command command to add
*/
@@ -74,7 +76,7 @@ public class EditScript<T> {
}
/**
- * Add an insert command to the script.
+ * Appends an insert command to the script.
*
* @param command command to add
*/
@@ -84,7 +86,7 @@ public class EditScript<T> {
}
/**
- * Add a delete command to the script.
+ * Appends a delete command to the script.
*
* @param command command to add
*/
@@ -94,7 +96,7 @@ public class EditScript<T> {
}
/**
- * Visit the script. The script implements the <em>visitor</em> design
+ * Visits the script. The script implements the <em>visitor</em> design
* pattern, this method is the entry point to which the user supplies its
* own visitor, the script will be responsible to drive it through the
* commands in order and call the appropriate method as each command is
@@ -109,7 +111,7 @@ public class EditScript<T> {
}
/**
- * Get the length of the Longest Common Subsequence (LCS). The length of the
+ * Gets the length of the Longest Common Subsequence (LCS). The length of the
* longest common subsequence is the number of {@link KeepCommand keep
* commands} in the script.
*
@@ -120,7 +122,7 @@ public class EditScript<T> {
}
/**
- * Get the number of effective modifications. The number of effective
+ * Gets the number of effective modifications. The number of effective
* modification is the number of {@link DeleteCommand delete} and
* {@link InsertCommand insert} commands in the script.
*
diff --git a/src/main/java/org/apache/commons/text/diff/InsertCommand.java b/src/main/java/org/apache/commons/text/diff/InsertCommand.java
index f8eb0e0..c3c29f5 100644
--- a/src/main/java/org/apache/commons/text/diff/InsertCommand.java
+++ b/src/main/java/org/apache/commons/text/diff/InsertCommand.java
@@ -35,7 +35,7 @@ package org.apache.commons.text.diff;
public class InsertCommand<T> extends EditCommand<T> {
/**
- * Simple constructor. Creates a new instance of InsertCommand
+ * Constructs a new instance of InsertCommand
*
* @param object the object of the second sequence that should be inserted
*/
@@ -44,7 +44,7 @@ public class InsertCommand<T> extends EditCommand<T> {
}
/**
- * Accept a visitor. When an {@code InsertCommand} accepts a visitor,
+ * Accepts a visitor. When an {@code InsertCommand} accepts a visitor,
* it calls its {@link CommandVisitor#visitInsertCommand visitInsertCommand}
* method.
*
diff --git a/src/main/java/org/apache/commons/text/diff/KeepCommand.java b/src/main/java/org/apache/commons/text/diff/KeepCommand.java
index efd4824..dc55d78 100644
--- a/src/main/java/org/apache/commons/text/diff/KeepCommand.java
+++ b/src/main/java/org/apache/commons/text/diff/KeepCommand.java
@@ -35,7 +35,7 @@ package org.apache.commons.text.diff;
public class KeepCommand<T> extends EditCommand<T> {
/**
- * Simple constructor. Creates a new instance of KeepCommand
+ * Constructs a new instance of KeepCommand
*
* @param object the object belonging to both sequences (the object is a
* reference to the instance in the first sequence which is known
@@ -46,7 +46,7 @@ public class KeepCommand<T> extends EditCommand<T> {
}
/**
- * Accept a visitor. When a {@code KeepCommand} accepts a visitor, it
+ * Accepts a visitor. When a {@code KeepCommand} accepts a visitor, it
* calls its {@link CommandVisitor#visitKeepCommand visitKeepCommand} method.
*
* @param visitor the visitor to be accepted
diff --git a/src/main/java/org/apache/commons/text/diff/ReplacementsFinder.java b/src/main/java/org/apache/commons/text/diff/ReplacementsFinder.java
index 6beff3b..a701b12 100644
--- a/src/main/java/org/apache/commons/text/diff/ReplacementsFinder.java
+++ b/src/main/java/org/apache/commons/text/diff/ReplacementsFinder.java
@@ -71,7 +71,7 @@ public class ReplacementsFinder<T> implements CommandVisitor<T> {
private final ReplacementsHandler<T> handler;
/**
- * Simple constructor. Creates a new instance of {@link ReplacementsFinder}.
+ * Constructs a new instance of {@link ReplacementsFinder}.
*
* @param handler handler to call when synchronized sequences are found
*/
diff --git a/src/main/java/org/apache/commons/text/diff/StringsComparator.java b/src/main/java/org/apache/commons/text/diff/StringsComparator.java
index b3963e5..90d53bb 100644
--- a/src/main/java/org/apache/commons/text/diff/StringsComparator.java
+++ b/src/main/java/org/apache/commons/text/diff/StringsComparator.java
@@ -70,10 +70,7 @@ public class StringsComparator {
private final int[] vUp;
/**
- * Simple constructor.
- * <p>
- * Creates a new instance of StringsComparator.
- * </p>
+ * Constructs a new instance of StringsComparator.
* <p>
* It is <em>guaranteed</em> that the comparisons will always be done as
* {@code o1.equals(o2)} where {@code o1} belongs to the first
@@ -95,7 +92,7 @@ public class StringsComparator {
}
/**
- * Get the {@link EditScript} object.
+ * Gets the {@link EditScript} object.
* <p>
* It is guaranteed that the objects embedded in the {@link InsertCommand
* insert commands} come from the second sequence and that the objects
@@ -115,7 +112,7 @@ public class StringsComparator {
}
/**
- * Build an edit script.
+ * Builds an edit script.
*
* @param start1 the begin of the first sequence to be compared
* @param end1 the end of the first sequence to be compared
@@ -164,7 +161,7 @@ public class StringsComparator {
}
/**
- * Get the middle snake corresponding to two subsequences of the
+ * Gets the middle snake corresponding to two subsequences of the
* main sequences.
* <p>
* The snake is found using the MYERS Algorithm (this algorithms has
@@ -254,7 +251,7 @@ public class StringsComparator {
}
/**
- * Build a snake.
+ * Builds a snake.
*
* @param start the value of the start of the snake
* @param diag the value of the diagonal of the snake
@@ -288,7 +285,7 @@ public class StringsComparator {
private final int diag;
/**
- * Simple constructor. Creates a new instance of Snake with specified indices.
+ * Constructs a new instance of Snake with specified indices.
*
* @param start start index of the snake
* @param end end index of the snake
@@ -301,7 +298,7 @@ public class StringsComparator {
}
/**
- * Get the start index of the snake.
+ * Gets the start index of the snake.
*
* @return start index of the snake
*/
@@ -310,7 +307,7 @@ public class StringsComparator {
}
/**
- * Get the end index of the snake.
+ * Gets the end index of the snake.
*
* @return end index of the snake
*/
@@ -319,7 +316,7 @@ public class StringsComparator {
}
/**
- * Get the diagonal number of the snake.
+ * Gets the diagonal number of the snake.
*
* @return diagonal number of the snake
*/
diff --git a/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java b/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
index 3cc1cb9..2a15452 100644
--- a/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
+++ b/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
@@ -149,7 +149,7 @@ public enum DoubleFormat {
private final Function<Builder, DoubleFunction<String>> factory;
/**
- * Construct a new instance.
+ * Constructs a new instance.
* @param factory function used to construct format instances
*/
DoubleFormat(final Function<Builder, DoubleFunction<String>> factory) {
@@ -157,7 +157,7 @@ public enum DoubleFormat {
}
/**
- * Return a {@link Builder} for constructing formatter functions for this format type.
+ * Creates a {@link Builder} for building formatter functions for this format type.
* @return builder instance
*/
public Builder builder() {
@@ -165,7 +165,7 @@ public enum DoubleFormat {
}
/**
- * Class for constructing configured format functions for standard double format types.
+ * Builds configured format functions for standard double format types.
*/
public static final class Builder {
@@ -227,7 +227,7 @@ public enum DoubleFormat {
private boolean alwaysIncludeExponent = false;
/**
- * Construct a new instance that delegates double function construction
+ * Builds a new instance that delegates double function construction
* to the given factory object.
* @param factory factory function
*/
@@ -236,7 +236,7 @@ public enum DoubleFormat {
}
/**
- * Set the maximum number of significant decimal digits used in format
+ * Sets the maximum number of significant decimal digits used in format
* results. A value of {@code 0} indicates no limit. The default value is {@code 0}.
* @param maxPrecision maximum precision
* @return this instance
@@ -247,7 +247,7 @@ public enum DoubleFormat {
}
/**
- * Set the minimum decimal exponent for formatted strings. No digits with an
+ * Sets the minimum decimal exponent for formatted strings. No digits with an
* absolute value of less than <code>10<sup>minDecimalExponent</sup></code> will
* be included in format results. If the number being formatted does not contain
* any such digits, then zero is returned. For example, if {@code minDecimalExponent}
@@ -263,7 +263,7 @@ public enum DoubleFormat {
}
/**
- * Set the maximum decimal exponent for numbers formatted as plain decimal strings when
+ * Sets the maximum decimal exponent for numbers formatted as plain decimal strings when
* using the {@link DoubleFormat#MIXED MIXED} format type. If the number being formatted
* has an absolute value less than <code>10<sup>plainFormatMaxDecimalExponent + 1</sup></code> and
* greater than or equal to <code>10<sup>plainFormatMinDecimalExponent</sup></code> after any
@@ -286,7 +286,7 @@ public enum DoubleFormat {
}
/**
- * Set the minimum decimal exponent for numbers formatted as plain decimal strings when
+ * Sets the minimum decimal exponent for numbers formatted as plain decimal strings when
* using the {@link DoubleFormat#MIXED MIXED} format type. If the number being formatted
* has an absolute value less than <code>10<sup>plainFormatMaxDecimalExponent + 1</sup></code> and
* greater than or equal to <code>10<sup>plainFormatMinDecimalExponent</sup></code> after any
@@ -309,7 +309,7 @@ public enum DoubleFormat {
}
/**
- * Set the flag determining whether or not the zero string may be returned with the minus
+ * Sets the flag determining whether or not the zero string may be returned with the minus
* sign or if it will always be returned in the positive form. For example, if set to {@code true},
* the string {@code "-0.0"} may be returned for some input numbers. If {@code false}, only {@code "0.0"}
* will be returned, regardless of the sign of the input number. The default value is {@code true}.
@@ -323,7 +323,7 @@ public enum DoubleFormat {
}
/**
- * Set the string containing the digit characters 0-9, in that order. The
+ * Sets the string containing the digit characters 0-9, in that order. The
* default value is the string {@code "0123456789"}.
* @param digits string containing the digit characters 0-9
* @return this instance
@@ -342,7 +342,7 @@ public enum DoubleFormat {
}
/**
- * Set the flag determining whether or not a zero character is added in the fraction position
+ * Sets the flag determining whether or not a zero character is added in the fraction position
* when no fractional value is present. For example, if set to {@code true}, the number {@code 1} would
* be formatted as {@code "1.0"}. If {@code false}, it would be formatted as {@code "1"}. The default
* value is {@code true}.
@@ -356,7 +356,7 @@ public enum DoubleFormat {
}
/**
- * Set the character used as the minus sign.
+ * Sets the character used as the minus sign.
* @param minusSign character to use as the minus sign
* @return this instance
*/
@@ -366,7 +366,7 @@ public enum DoubleFormat {
}
/**
- * Set the decimal separator character, i.e., the character placed between the
+ * Sets the decimal separator character, i.e., the character placed between the
* whole number and fractional portions of the formatted strings. The default value
* is {@code '.'}.
* @param decimalSeparator decimal separator character
@@ -378,7 +378,7 @@ public enum DoubleFormat {
}
/**
- * Set the character used to separate groups of thousands. Default value is {@code ','}.
+ * Sets the character used to separate groups of thousands. Default value is {@code ','}.
* @param groupingSeparator character used to separate groups of thousands
* @return this instance
* @see #groupThousands(boolean)
@@ -403,7 +403,7 @@ public enum DoubleFormat {
}
/**
- * Set the exponent separator character, i.e., the string placed between
+ * Sets the exponent separator character, i.e., the string placed between
* the mantissa and the exponent. The default value is {@code "E"}, as in
* {@code "1.2E6"}.
* @param exponentSeparator exponent separator string
@@ -416,7 +416,7 @@ public enum DoubleFormat {
}
/**
- * Set the flag indicating if an exponent value should always be included in the
+ * Sets the flag indicating if an exponent value should always be included in the
* formatted value, even if the exponent value is zero. This property only applies
* to formats that use scientific notation, namely
* {@link DoubleFormat#SCIENTIFIC SCIENTIFIC},
@@ -432,7 +432,7 @@ public enum DoubleFormat {
}
/**
- * Set the string used to represent infinity. For negative infinity, this string
+ * Sets the string used to represent infinity. For negative infinity, this string
* is prefixed with the {@link #minusSign(char) minus sign}.
* @param infinity string used to represent infinity
* @return this instance
@@ -444,7 +444,7 @@ public enum DoubleFormat {
}
/**
- * Set the string used to represent {@link Double#NaN}.
+ * Sets the string used to represent {@link Double#NaN}.
* @param nan string used to represent {@link Double#NaN}
* @return this instance
* @throws NullPointerException if the argument is {@code null}
@@ -455,7 +455,7 @@ public enum DoubleFormat {
}
/**
- * Configure this instance with the given format symbols. The following values
+ * Configures this instance with the given format symbols. The following values
* are set:
* <ul>
* <li>{@link #digits(String) digit characters}</li>
@@ -486,7 +486,7 @@ public enum DoubleFormat {
}
/**
- * Get a string containing the localized digits 0-9 for the given symbols object. The
+ * Gets a string containing the localized digits 0-9 for the given symbols object. The
* string is constructed by starting at the {@link DecimalFormatSymbols#getZeroDigit() zero digit}
* and adding the next 9 consecutive characters.
* @param symbols symbols object
@@ -504,7 +504,7 @@ public enum DoubleFormat {
}
/**
- * Construct a new double format function.
+ * Builds a new double format function.
* @return format function
*/
public DoubleFunction<String> build() {
@@ -561,7 +561,7 @@ public enum DoubleFormat {
private final boolean alwaysIncludeExponent;
/**
- * Construct a new instance.
+ * Constructs a new instance.
* @param builder builder instance containing configuration values
*/
AbstractDoubleFormat(final Builder builder) {
@@ -651,7 +651,7 @@ public enum DoubleFormat {
}
/**
- * Return a formatted string representation of the given finite value.
+ * Returns a formatted string representation of the given finite value.
* @param d double value
*/
private String applyFinite(final double d) {
@@ -667,7 +667,7 @@ public enum DoubleFormat {
}
/**
- * Return a formatted representation of the given rounded decimal value to {@code dst}.
+ * Returns a formatted representation of the given rounded decimal value to {@code dst}.
* @param val value to format
* @return a formatted representation of the given rounded decimal value to {@code dst}.
*/
@@ -680,7 +680,8 @@ public enum DoubleFormat {
*/
private static class PlainDoubleFormat extends AbstractDoubleFormat {
- /** Construct a new instance.
+ /**
+ * Constructs a new instance.
* @param builder builder instance containing configuration values
*/
PlainDoubleFormat(final Builder builder) {
@@ -688,7 +689,8 @@ public enum DoubleFormat {
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}
+ */
@Override
protected String applyFiniteInternal(final ParsedDecimal val) {
return val.toPlainString(this);
@@ -709,7 +711,7 @@ public enum DoubleFormat {
private final int plainMinExponent;
/**
- * Construct a new instance.
+ * Constructs a new instance.
* @param builder builder instance containing configuration values
*/
MixedDoubleFormat(final Builder builder) {
@@ -736,7 +738,7 @@ public enum DoubleFormat {
private static class ScientificDoubleFormat extends AbstractDoubleFormat {
/**
- * Construct a new instance.
+ * Constructs a new instance.
* @param builder builder instance containing configuration values
*/
ScientificDoubleFormat(final Builder builder) {
@@ -756,7 +758,7 @@ public enum DoubleFormat {
private static class EngineeringDoubleFormat extends AbstractDoubleFormat {
/**
- * Construct a new instance.
+ * Constructs a new instance.
* @param builder builder instance containing configuration values
*/
EngineeringDoubleFormat(final Builder builder) {
diff --git a/src/main/java/org/apache/commons/text/numbers/ParsedDecimal.java b/src/main/java/org/apache/commons/text/numbers/ParsedDecimal.java
index 91f279c..c01b78b 100644
--- a/src/main/java/org/apache/commons/text/numbers/ParsedDecimal.java
+++ b/src/main/java/org/apache/commons/text/numbers/ParsedDecimal.java
@@ -144,7 +144,7 @@ final class ParsedDecimal {
private int outputIdx;
/**
- * Construct a new instance from its parts.
+ * Constructs a new instance from its parts.
* @param negative {@code true} if the value is negative
* @param digits array containing significant digits
* @param digitCount number of digits used from the {@code digits} array
@@ -159,7 +159,7 @@ final class ParsedDecimal {
}
/**
- * Get the exponent value. This exponent produces a floating point value with the
+ * Gets the exponent value. This exponent produces a floating point value with the
* correct magnitude when applied to the internal unsigned integer.
* @return exponent value
*/
@@ -168,7 +168,7 @@ final class ParsedDecimal {
}
/**
- * Get the exponent that would be used when representing this number in scientific
+ * Get sthe exponent that would be used when representing this number in scientific
* notation (i.e., with a single non-zero digit in front of the decimal point).
* @return the exponent that would be used when representing this number in scientific
* notation
@@ -178,7 +178,7 @@ final class ParsedDecimal {
}
/**
- * Round the instance to the given decimal exponent position using
+ * Rounds the instance to the given decimal exponent position using
* {@link java.math.RoundingMode#HALF_EVEN half-even rounding}. For example, a value of {@code -2}
* will round the instance to the digit at the position 10<sup>-2</sup> (i.e. to the closest multiple of 0.01).
* @param roundExponent exponent defining the decimal place to round to
@@ -201,7 +201,7 @@ final class ParsedDecimal {
}
/**
- * Ensure that this instance has <em>at most</em> the given number of significant digits
+ * Ensures that this instance has <em>at most</em> the given number of significant digits
* (i.e. precision). If this instance already has a precision less than or equal
* to the argument, nothing is done. If the given precision requires a reduction in the number
* of digits, then the value is rounded using {@link java.math.RoundingMode#HALF_EVEN half-even rounding}.
@@ -218,7 +218,7 @@ final class ParsedDecimal {
}
/**
- * Return a string representation of this value with no exponent field. Ex:
+ * Returns a string representation of this value with no exponent field. Ex:
* <pre>
* 10 = "10.0"
* 1e-6 = "0.000001"
@@ -245,7 +245,7 @@ final class ParsedDecimal {
}
/**
- * Return a string representation of this value in scientific notation. Ex:
+ * Returns a string representation of this value in scientific notation. Ex:
* <pre>
* 0 = "0.0"
* 10 = "1.0E1"
@@ -260,7 +260,7 @@ final class ParsedDecimal {
}
/**
- * Return a string representation of this value in engineering notation. This
+ * Returns a string representation of this value in engineering notation. This
* is similar to {@link #toScientificString(FormatOptions) scientific notation}
* but with the exponent forced to be a multiple of 3, allowing easier alignment with SI prefixes.
* <pre>
@@ -278,7 +278,7 @@ final class ParsedDecimal {
}
/**
- * Return a string representation of the value in scientific notation using the
+ * Returns a string representation of the value in scientific notation using the
* given decimal point position.
* @param decimalPos decimal position relative to the {@code digits} array; this value
* is expected to be greater than 0
@@ -336,7 +336,7 @@ final class ParsedDecimal {
}
/**
- * Prepare the output buffer for a string of the given size.
+ * Prepares the output buffer for a string of the given size.
* @param size buffer size
*/
private void prepareOutput(final int size) {
@@ -345,7 +345,7 @@ final class ParsedDecimal {
}
/**
- * Get the output buffer as a string.
+ * Gets the output buffer as a string.
* @return output buffer as a string
*/
private String outputString() {
@@ -355,7 +355,7 @@ final class ParsedDecimal {
}
/**
- * Append the given character to the output buffer.
+ * Appends the given character to the output buffer.
* @param ch character to append
*/
private void append(final char ch) {
@@ -363,7 +363,7 @@ final class ParsedDecimal {
}
/**
- * Append the given character array directly to the output buffer.
+ * Appends the given character array directly to the output buffer.
* @param chars characters to append
*/
private void append(final char[] chars) {
@@ -373,7 +373,7 @@ final class ParsedDecimal {
}
/**
- * Append the localized representation of the digit {@code n} to the output buffer.
+ * Appends the localized representation of the digit {@code n} to the output buffer.
* @param n digit to append
* @param digitChars character array containing localized versions of the digits {@code 0-9}
* in that order
@@ -383,7 +383,7 @@ final class ParsedDecimal {
}
/**
- * Append the whole number portion of this value to the output buffer. No thousands
+ * Appends the whole number portion of this value to the output buffer. No thousands
* separators are added.
* @param wholeCount total number of digits required to the left of the decimal point
* @param opts format options
@@ -417,7 +417,7 @@ final class ParsedDecimal {
}
/**
- * Append the whole number portion of this value to the output buffer, adding thousands
+ * Appends the whole number portion of this value to the output buffer, adding thousands
* separators as needed.
* @param wholeCount total number of digits required to the right of the decimal point
* @param opts format options
@@ -459,7 +459,7 @@ final class ParsedDecimal {
}
/**
- * Return {@code true} if a grouping separator should be added after the whole digit
+ * Returns {@code true} if a grouping separator should be added after the whole digit
* character at the given position.
* @param pos whole digit character position, with values starting at 1 and increasing
* from right to left.
@@ -470,7 +470,7 @@ final class ParsedDecimal {
}
/**
- * Append the fractional component of the number to the current output buffer.
+ * Appends the fractional component of the number to the current output buffer.
* @param zeroCount number of zeros to add after the decimal point and before the
* first significant digit
* @param startIdx significant digit start index
@@ -499,7 +499,7 @@ final class ParsedDecimal {
}
/**
- * Get the number of characters required to create a plain format representation
+ * Gets the number of characters required to create a plain format representation
* of this value.
* @param decimalPos decimal position relative to the {@code digits} array
* @param opts format options
@@ -518,7 +518,7 @@ final class ParsedDecimal {
}
/**
- * Get the number of characters required for the digit portion of a string representation of
+ * Gets the number of characters required for the digit portion of a string representation of
* this value. This excludes any exponent or thousands groupings characters.
* @param decimalPos decimal point position relative to the {@code digits} array
* @param opts format options
@@ -551,7 +551,7 @@ final class ParsedDecimal {
}
/**
- * Return {@code true} if formatted strings should include the minus sign, considering
+ * Returns {@code true} if formatted strings should include the minus sign, considering
* the value of this instance and the given format options.
* @param opts format options
* @return {@code true} if a minus sign should be included in the output
@@ -561,7 +561,7 @@ final class ParsedDecimal {
}
/**
- * Return {@code true} if a formatted string with the given target exponent should include
+ * Returns {@code true} if a formatted string with the given target exponent should include
* the exponent field.
* @param targetExponent exponent of the formatted result
* @param opts format options
@@ -572,7 +572,7 @@ final class ParsedDecimal {
}
/**
- * Return {@code true} if a rounding operation for the given number of digits should
+ * Returns {@code true} if a rounding operation for the given number of digits should
* round up.
* @param count number of digits to round to; must be greater than zero and less
* than the current number of digits
@@ -593,7 +593,7 @@ final class ParsedDecimal {
}
/**
- * Round the value up to the given number of digits.
+ * Rounds the value up to the given number of digits.
* @param count target number of digits; must be greater than zero and
* less than the current number of digits
*/
@@ -623,7 +623,7 @@ final class ParsedDecimal {
}
/**
- * Return {@code true} if this value is equal to zero. The sign field is ignored,
+ * Returns {@code true} if this value is equal to zero. The sign field is ignored,
* meaning that this method will return {@code true} for both {@code +0} and {@code -0}.
* @return {@code true} if the value is equal to zero
*/
@@ -632,7 +632,7 @@ final class ParsedDecimal {
}
/**
- * Set the value of this instance to a single digit with the given exponent.
+ * Sets the value of this instance to a single digit with the given exponent.
* The sign of the value is retained.
* @param digit digit value
* @param newExponent new exponent value
@@ -644,7 +644,7 @@ final class ParsedDecimal {
}
/**
- * Truncate the value to the given number of digits.
+ * Truncates the value to the given number of digits.
* @param count number of digits; must be greater than zero and less than
* the current number of digits
*/
@@ -662,7 +662,7 @@ final class ParsedDecimal {
}
/**
- * Construct a new instance from the given double value.
+ * Constructs a new instance from the given double value.
* @param d double value
* @return a new instance containing the parsed components of the given double value
* @throws IllegalArgumentException if {@code d} is {@code NaN} or infinite
@@ -730,7 +730,7 @@ final class ParsedDecimal {
}
/**
- * Parse a double exponent value from {@code chars}, starting at the {@code start}
+ * Parses a double exponent value from {@code chars}, starting at the {@code start}
* index and continuing through the end of the array.
* @param chars character array to parse a double exponent value from
* @param start start index
@@ -752,7 +752,7 @@ final class ParsedDecimal {
}
/**
- * Get the numeric value of the given digit character. No validation of the
+ * Gets the numeric value of the given digit character. No validation of the
* character type is performed.
* @param ch digit character
* @return numeric value of the digit character, ex: '1' = 1
diff --git a/src/main/java/org/apache/commons/text/similarity/CosineDistance.java b/src/main/java/org/apache/commons/text/similarity/CosineDistance.java
index 516c215..5c9a24c 100644
--- a/src/main/java/org/apache/commons/text/similarity/CosineDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/CosineDistance.java
@@ -34,10 +34,12 @@ import java.util.Map;
* @see CosineSimilarity
*/
public class CosineDistance implements EditDistance<Double> {
+
/**
* Tokenizer used to convert the character sequence into a vector.
*/
private final Tokenizer<CharSequence> tokenizer = new RegexTokenizer();
+
/**
* Cosine similarity.
*/
diff --git a/src/main/java/org/apache/commons/text/similarity/EditDistanceFrom.java b/src/main/java/org/apache/commons/text/similarity/EditDistanceFrom.java
index 310b6bb..5aef77f 100644
--- a/src/main/java/org/apache/commons/text/similarity/EditDistanceFrom.java
+++ b/src/main/java/org/apache/commons/text/similarity/EditDistanceFrom.java
@@ -19,11 +19,9 @@ package org.apache.commons.text.similarity;
import org.apache.commons.lang3.Validate;
/**
- * <p>
* This stores a {@link EditDistance} implementation and a {@link CharSequence} "left" string.
* The {@link #apply(CharSequence right)} method accepts the "right" string and invokes the
* comparison function for the pair of strings.
- * </p>
*
* <p>
* The following is an example which finds the most similar string:
@@ -64,7 +62,7 @@ public class EditDistanceFrom<R> {
private final CharSequence left;
/**
- * <p>This accepts the edit distance implementation and the "left" string.</p>
+ * This accepts the edit distance implementation and the "left" string.
*
* @param editDistance This may not be null.
* @param left This may be null here,
@@ -79,10 +77,8 @@ public class EditDistanceFrom<R> {
}
/**
- * <p>
* This compares "left" field against the "right" parameter
* using the "edit distance" implementation.
- * </p>
*
* @param right the second CharSequence
* @return The similarity score between two CharSequences
diff --git a/src/main/java/org/apache/commons/text/similarity/FuzzyScore.java b/src/main/java/org/apache/commons/text/similarity/FuzzyScore.java
index 8dcc526..6ec3851 100644
--- a/src/main/java/org/apache/commons/text/similarity/FuzzyScore.java
+++ b/src/main/java/org/apache/commons/text/similarity/FuzzyScore.java
@@ -42,7 +42,7 @@ public class FuzzyScore {
/**
- * <p>This returns a {@link Locale}-specific {@link FuzzyScore}.</p>
+ * This returns a {@link Locale}-specific {@link FuzzyScore}.
*
* @param locale The string matching logic is case insensitive.
A {@link Locale} is necessary to normalize both Strings to lower case.
@@ -57,10 +57,8 @@ public class FuzzyScore {
}
/**
- * <p>
* Find the Fuzzy Score which indicates the similarity score between two
* Strings.
- * </p>
*
* <pre>
* score.fuzzyScore(null, null) = IllegalArgumentException
diff --git a/src/main/java/org/apache/commons/text/similarity/IntersectionResult.java b/src/main/java/org/apache/commons/text/similarity/IntersectionResult.java
index 70536be..7271059 100644
--- a/src/main/java/org/apache/commons/text/similarity/IntersectionResult.java
+++ b/src/main/java/org/apache/commons/text/similarity/IntersectionResult.java
@@ -30,21 +30,24 @@ import java.util.Objects;
* @see <a href="https://en.wikipedia.org/wiki/Intersection_(set_theory)">Intersection</a>
*/
public class IntersectionResult {
+
/**
* The size of set A.
*/
private final int sizeA;
+
/**
* The size of set B.
*/
private final int sizeB;
+
/**
* The size of the intersection between set A and B.
*/
private final int intersection;
/**
- * Create the results for an intersection between two sets.
+ * Constructs the results for an intersection between two sets.
*
* @param sizeA the size of set A ({@code |A|})
* @param sizeB the size of set B ({@code |B|})
@@ -68,7 +71,7 @@ public class IntersectionResult {
}
/**
- * Get the size of set A.
+ * Gets the size of set A.
*
* @return |A|
*/
@@ -77,7 +80,7 @@ public class IntersectionResult {
}
/**
- * Get the size of set B.
+ * Gets the size of set B.
*
* @return |B|
*/
@@ -86,7 +89,7 @@ public class IntersectionResult {
}
/**
- * Get the size of the intersection between set A and B.
+ * Gets the size of the intersection between set A and B.
*
* @return {@code |A ∩ B|}
*/
diff --git a/src/main/java/org/apache/commons/text/similarity/IntersectionSimilarity.java b/src/main/java/org/apache/commons/text/similarity/IntersectionSimilarity.java
index 5d9707c..09af8fe 100644
--- a/src/main/java/org/apache/commons/text/similarity/IntersectionSimilarity.java
+++ b/src/main/java/org/apache/commons/text/similarity/IntersectionSimilarity.java
@@ -121,9 +121,11 @@ public class IntersectionSimilarity<T> implements SimilarityScore<IntersectionRe
/**
* Create a new intersection similarity using the provided converter.
*
- * <p>If the converter returns a {@link Set} then the intersection result will
+ * <p>
+ * If the converter returns a {@link Set} then the intersection result will
* not include duplicates. Any other {@link Collection} is used to produce a result
* that will include duplicates in the intersect and union.
+ * </p>
*
* @param converter the converter used to create the elements from the characters
* @throws IllegalArgumentException if the converter is null
@@ -183,7 +185,7 @@ public class IntersectionSimilarity<T> implements SimilarityScore<IntersectionRe
}
/**
- * Convert the collection to a bag. The bag will contain the count of each element
+ * Converts the collection to a bag. The bag will contain the count of each element
* in the collection.
*
* @param objects the objects
@@ -198,7 +200,7 @@ public class IntersectionSimilarity<T> implements SimilarityScore<IntersectionRe
}
/**
- * Compute the intersection between two sets. This is the count of all the elements
+ * Computes the intersection between two sets. This is the count of all the elements
* that are within both sets.
*
* @param <T> the type of the elements in the set
@@ -217,7 +219,7 @@ public class IntersectionSimilarity<T> implements SimilarityScore<IntersectionRe
}
/**
- * Compute the intersection between two bags. This is the sum of the minimum
+ * Computes the intersection between two bags. This is the sum of the minimum
* count of each element that is within both sets.
*
* @param bagA the bag A
diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
index e505242..7d41104 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDetailedDistance.java
@@ -35,6 +35,7 @@ public class LevenshteinDetailedDistance implements EditDistance<LevenshteinResu
* Default instance.
*/
private static final LevenshteinDetailedDistance DEFAULT_INSTANCE = new LevenshteinDetailedDistance();
+
/**
* Threshold.
*/
@@ -67,7 +68,7 @@ public class LevenshteinDetailedDistance implements EditDistance<LevenshteinResu
}
/**
- * <p>Find the Levenshtein distance between two Strings.</p>
+ * Finds the Levenshtein distance between two Strings.
*
* <p>A higher score indicates a greater distance.</p>
*
@@ -125,7 +126,7 @@ public class LevenshteinDetailedDistance implements EditDistance<LevenshteinResu
}
/**
- * Find the Levenshtein distance between two CharSequences if it's less than or
+ * Finds the Levenshtein distance between two CharSequences if it's less than or
* equal to a given threshold.
*
* <p>
@@ -306,7 +307,7 @@ public class LevenshteinDetailedDistance implements EditDistance<LevenshteinResu
}
/**
- * <p>Find the Levenshtein distance between two Strings.</p>
+ * Finds the Levenshtein distance between two Strings.
*
* <p>A higher score indicates a greater distance.</p>
*
diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
index 1154027..7f90a53 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -46,10 +46,8 @@ public class LevenshteinDistance implements EditDistance<Integer> {
private final Integer threshold;
/**
- * <p>
* This returns the default instance that uses a version
* of the algorithm that does not use a threshold parameter.
- * </p>
*
* @see LevenshteinDistance#getDefaultInstance()
*/
@@ -58,10 +56,8 @@ public class LevenshteinDistance implements EditDistance<Integer> {
}
/**
- * <p>
* If the threshold is not null, distance calculations will be limited to a maximum length.
* If the threshold is null, the unlimited version of the algorithm will be used.
- * </p>
*
* @param threshold
* If this is null then distances calculations will not be limited.
@@ -75,7 +71,7 @@ public class LevenshteinDistance implements EditDistance<Integer> {
}
/**
- * <p>Find the Levenshtein distance between two Strings.</p>
+ * Finds the Levenshtein distance between two Strings.
*
* <p>A higher score indicates a greater distance.</p>
*
@@ -310,7 +306,7 @@ public class LevenshteinDistance implements EditDistance<Integer> {
}
/**
- * <p>Find the Levenshtein distance between two Strings.</p>
+ * Finds the Levenshtein distance between two Strings.
*
* <p>A higher score indicates a greater distance.</p>
*
diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinResults.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinResults.java
index e6c666f..c1935ce 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinResults.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinResults.java
@@ -29,25 +29,29 @@ import java.util.Objects;
* @since 1.0
*/
public class LevenshteinResults {
+
/**
* Edit distance.
*/
private final Integer distance;
+
/**
* Insert character count.
*/
private final Integer insertCount;
+
/**
* Delete character count.
*/
private final Integer deleteCount;
+
/**
* Substitute character count.
*/
private final Integer substituteCount;
/**
- * Create the results for a detailed Levenshtein distance.
+ * Constructs the results for a detailed Levenshtein distance.
*
* @param distance distance between two character sequences.
* @param insertCount insert character count
@@ -63,7 +67,7 @@ public class LevenshteinResults {
}
/**
- * Get the distance between two character sequences.
+ * Gets the distance between two character sequences.
*
* @return distance between two character sequence
*/
@@ -72,7 +76,7 @@ public class LevenshteinResults {
}
/**
- * Get the number of insertion needed to change one character sequence into another.
+ * Gets the number of insertion needed to change one character sequence into another.
*
* @return insert character count
*/
@@ -81,7 +85,7 @@ public class LevenshteinResults {
}
/**
- * Get the number of character deletion needed to change one character sequence to other.
+ * Gets the number of character deletion needed to change one character sequence to other.
*
* @return delete character count
*/
@@ -90,7 +94,7 @@ public class LevenshteinResults {
}
/**
- * Get the number of character substitution needed to change one character sequence into another.
+ * Gets the number of character substitution needed to change one character sequence into another.
*
* @return substitute character count
*/
diff --git a/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java b/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java
index 84a424d..af5a5a9 100644
--- a/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java
+++ b/src/main/java/org/apache/commons/text/similarity/RegexTokenizer.java
@@ -33,6 +33,7 @@ import org.apache.commons.lang3.Validate;
* @since 1.0
*/
class RegexTokenizer implements Tokenizer<CharSequence> {
+
/** The whitespace pattern. */
private static final Pattern PATTERN = Pattern.compile("(\\w)+");
diff --git a/src/main/java/org/apache/commons/text/similarity/SimilarityScoreFrom.java b/src/main/java/org/apache/commons/text/similarity/SimilarityScoreFrom.java
index 22ffc41..31184ab 100644
--- a/src/main/java/org/apache/commons/text/similarity/SimilarityScoreFrom.java
+++ b/src/main/java/org/apache/commons/text/similarity/SimilarityScoreFrom.java
@@ -19,11 +19,9 @@ package org.apache.commons.text.similarity;
import org.apache.commons.lang3.Validate;
/**
- * <p>
* This stores a {@link SimilarityScore} implementation and a {@link CharSequence} "left" string.
* The {@link #apply(CharSequence right)} method accepts the "right" string and invokes the
* comparison function for the pair of strings.
- * </p>
*
* <p>
* The following is an example which finds the most similar string:
@@ -58,13 +56,14 @@ public class SimilarityScoreFrom<R> {
* Similarity score.
*/
private final SimilarityScore<R> similarityScore;
+
/**
* Left parameter used in distance function.
*/
private final CharSequence left;
/**
- * <p>This accepts the similarity score implementation and the "left" string.</p>
+ * This accepts the similarity score implementation and the "left" string.
*
* @param similarityScore This may not be null.
* @param left This may be null here,
@@ -79,10 +78,8 @@ public class SimilarityScoreFrom<R> {
}
/**
- * <p>
* This compares "left" field against the "right" parameter
* using the "similarity score" implementation.
- * </p>
*
* @param right the second CharSequence
* @return The similarity score between two CharSequences
diff --git a/src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java b/src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java
index 7e56788..fa80a2b 100644
--- a/src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java
@@ -128,8 +128,8 @@ public abstract class CharSequenceTranslator {
}
/**
- * <p>Returns an upper case hexadecimal {@code String} for the given
- * character.</p>
+ * Returns an upper case hexadecimal {@code String} for the given
+ * character.
*
* @param codepoint The codepoint to convert.
* @return An upper case hexadecimal {@code String}
diff --git a/src/main/java/org/apache/commons/text/translate/CodePointTranslator.java b/src/main/java/org/apache/commons/text/translate/CodePointTranslator.java
index d225aac..e5ea5e3 100644
--- a/src/main/java/org/apache/commons/text/translate/CodePointTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/CodePointTranslator.java
@@ -39,7 +39,7 @@ public abstract class CodePointTranslator extends CharSequenceTranslator {
}
/**
- * Translate the specified codepoint into another.
+ * Translates the specified codepoint into another.
*
* @param codepoint int character input to translate
* @param writer Writer to optionally push the translated output to
diff --git a/src/main/java/org/apache/commons/text/translate/EntityArrays.java b/src/main/java/org/apache/commons/text/translate/EntityArrays.java
index 0c36c6f..73f9e47 100644
--- a/src/main/java/org/apache/commons/text/translate/EntityArrays.java
+++ b/src/main/java/org/apache/commons/text/translate/EntityArrays.java
@@ -74,7 +74,7 @@ public class EntityArrays {
initialMap.put("\u00C2", "Â"); // Â - uppercase A, circumflex accent
initialMap.put("\u00C3", "Ã"); // Ã - uppercase A, tilde
initialMap.put("\u00C4", "Ä"); // Ä - uppercase A, umlaut
- initialMap.put("\u00C5", "Å"); // Å - uppercase A, ring
+ initialMap.put("\u00C5", "Å"); // � - uppercase A, ring
initialMap.put("\u00C6", "Æ"); // Æ - uppercase AE
initialMap.put("\u00C7", "Ç"); // Ç - uppercase C, cedilla
initialMap.put("\u00C8", "È"); // È - uppercase E, grave accent
@@ -140,6 +140,7 @@ public class EntityArrays {
* Reverse of {@link #ISO8859_1_ESCAPE} for unescaping purposes.
*/
public static final Map<CharSequence, CharSequence> ISO8859_1_UNESCAPE;
+
static {
ISO8859_1_UNESCAPE = Collections.unmodifiableMap(invert(ISO8859_1_ESCAPE));
}
@@ -151,6 +152,7 @@ public class EntityArrays {
* HTML 4.0 character entities.
*/
public static final Map<CharSequence, CharSequence> HTML40_EXTENDED_ESCAPE;
+
static {
final Map<CharSequence, CharSequence> initialMap = new HashMap<>();
// <!-- Latin Extended-B -->
@@ -354,6 +356,7 @@ public class EntityArrays {
* Reverse of {@link #HTML40_EXTENDED_ESCAPE} for unescaping purposes.
*/
public static final Map<CharSequence, CharSequence> HTML40_EXTENDED_UNESCAPE;
+
static {
HTML40_EXTENDED_UNESCAPE = Collections.unmodifiableMap(invert(HTML40_EXTENDED_ESCAPE));
}
@@ -365,6 +368,7 @@ public class EntityArrays {
* Namely: {@code " & < >}
*/
public static final Map<CharSequence, CharSequence> BASIC_ESCAPE;
+
static {
final Map<CharSequence, CharSequence> initialMap = new HashMap<>();
initialMap.put("\"", """); // " - double-quote
@@ -378,6 +382,7 @@ public class EntityArrays {
* Reverse of {@link #BASIC_ESCAPE} for unescaping purposes.
*/
public static final Map<CharSequence, CharSequence> BASIC_UNESCAPE;
+
static {
BASIC_UNESCAPE = Collections.unmodifiableMap(invert(BASIC_ESCAPE));
}
@@ -387,6 +392,7 @@ public class EntityArrays {
* its XML character entity.
*/
public static final Map<CharSequence, CharSequence> APOS_ESCAPE;
+
static {
final Map<CharSequence, CharSequence> initialMap = new HashMap<>();
initialMap.put("'", "'"); // XML apostrophe
@@ -397,6 +403,7 @@ public class EntityArrays {
* Reverse of {@link #APOS_ESCAPE} for unescaping purposes.
*/
public static final Map<CharSequence, CharSequence> APOS_UNESCAPE;
+
static {
APOS_UNESCAPE = Collections.unmodifiableMap(invert(APOS_ESCAPE));
}
@@ -408,6 +415,7 @@ public class EntityArrays {
* Namely: {@code \b \n \t \f \r}
*/
public static final Map<CharSequence, CharSequence> JAVA_CTRL_CHARS_ESCAPE;
+
static {
final Map<CharSequence, CharSequence> initialMap = new HashMap<>();
initialMap.put("\b", "\\b");
@@ -422,12 +430,14 @@ public class EntityArrays {
* Reverse of {@link #JAVA_CTRL_CHARS_ESCAPE} for unescaping purposes.
*/
public static final Map<CharSequence, CharSequence> JAVA_CTRL_CHARS_UNESCAPE;
+
static {
JAVA_CTRL_CHARS_UNESCAPE = Collections.unmodifiableMap(invert(JAVA_CTRL_CHARS_ESCAPE));
}
/**
- * Used to invert an escape Map into an unescape Map.
+ * Inverts an escape Map into an unescape Map.
+ *
* @param map Map<String, String> to be inverted
* @return Map<String, String> inverted array
*/
diff --git a/src/main/java/org/apache/commons/text/translate/JavaUnicodeEscaper.java b/src/main/java/org/apache/commons/text/translate/JavaUnicodeEscaper.java
index bc9a157..49a8041 100644
--- a/src/main/java/org/apache/commons/text/translate/JavaUnicodeEscaper.java
+++ b/src/main/java/org/apache/commons/text/translate/JavaUnicodeEscaper.java
@@ -24,9 +24,7 @@ package org.apache.commons.text.translate;
public class JavaUnicodeEscaper extends UnicodeEscaper {
/**
- * <p>
* Constructs a {@code JavaUnicodeEscaper} above the specified value (exclusive).
- * </p>
*
* @param codepoint
* above which to escape
@@ -37,9 +35,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
}
/**
- * <p>
* Constructs a {@code JavaUnicodeEscaper} below the specified value (exclusive).
- * </p>
*
* @param codepoint
* below which to escape
@@ -50,9 +46,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
}
/**
- * <p>
* Constructs a {@code JavaUnicodeEscaper} between the specified values (inclusive).
- * </p>
*
* @param codepointLow
* above which to escape
@@ -65,9 +59,7 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
}
/**
- * <p>
* Constructs a {@code JavaUnicodeEscaper} outside of the specified values (exclusive).
- * </p>
*
* @param codepointLow
* below which to escape
@@ -80,11 +72,9 @@ public class JavaUnicodeEscaper extends UnicodeEscaper {
}
/**
- * <p>
* Constructs a {@code JavaUnicodeEscaper} for the specified range. This is the underlying method for the
* other constructors/builders. The {@code below} and {@code above} boundaries are inclusive when
* {@code between} is {@code true} and exclusive when it is {@code false}.
- * </p>
*
* @param below
* int value representing the lowest codepoint boundary
diff --git a/src/main/java/org/apache/commons/text/translate/LookupTranslator.java b/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
index a143cf8..18a7c93 100644
--- a/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
@@ -32,15 +32,18 @@ public class LookupTranslator extends CharSequenceTranslator {
/** The mapping to be used in translation. */
private final Map<String, String> lookupMap;
+
/** The first character of each key in the lookupMap. */
private final BitSet prefixSet;
+
/** The length of the shortest key in the lookupMap. */
private final int shortest;
+
/** The length of the longest key in the lookupMap. */
private final int longest;
/**
- * Define the lookup table to be used in translation
+ * Constructs the lookup table to be used in translation
*
* Note that, as of Lang 3.1 (the origin of this code), the key to the lookup
* table is converted to a java.lang.String. This is because we need the key
diff --git a/src/main/java/org/apache/commons/text/translate/NumericEntityEscaper.java b/src/main/java/org/apache/commons/text/translate/NumericEntityEscaper.java
index a2b31b5..b19dea2 100644
--- a/src/main/java/org/apache/commons/text/translate/NumericEntityEscaper.java
+++ b/src/main/java/org/apache/commons/text/translate/NumericEntityEscaper.java
@@ -30,13 +30,15 @@ public class NumericEntityEscaper extends CodePointTranslator {
/** whether to escape between the boundaries or outside them. */
private final boolean between;
+
/** range from lowest codepoint to highest codepoint. */
private final Range<Integer> range;
+
/**
- * <p>Constructs a {@code NumericEntityEscaper} for the specified range. This is
+ * Constructs a {@code NumericEntityEscaper} for the specified range. This is
* the underlying method for the other constructors/builders. The {@code below}
* and {@code above} boundaries are inclusive when {@code between} is
- * {@code true} and exclusive when it is {@code false}.</p>
+ * {@code true} and exclusive when it is {@code false}.
*
* @param below int value representing the lowest codepoint boundary
* @param above int value representing the highest codepoint boundary
@@ -48,14 +50,14 @@ public class NumericEntityEscaper extends CodePointTranslator {
}
/**
- * <p>Constructs a {@code NumericEntityEscaper} for all characters.</p>
+ * Constructs a {@code NumericEntityEscaper} for all characters.
*/
public NumericEntityEscaper() {
this(0, Integer.MAX_VALUE, true);
}
/**
- * <p>Constructs a {@code NumericEntityEscaper} below the specified value (exclusive).</p>
+ * Constructs a {@code NumericEntityEscaper} below the specified value (exclusive).
*
* @param codepoint below which to escape
* @return The newly created {@code NumericEntityEscaper} instance
@@ -65,7 +67,7 @@ public class NumericEntityEscaper extends CodePointTranslator {
}
/**
- * <p>Constructs a {@code NumericEntityEscaper} above the specified value (exclusive).</p>
+ * Constructs a {@code NumericEntityEscaper} above the specified value (exclusive).
*
* @param codepoint above which to escape
* @return The newly created {@code NumericEntityEscaper} instance
@@ -75,7 +77,7 @@ public class NumericEntityEscaper extends CodePointTranslator {
}
/**
- * <p>Constructs a {@code NumericEntityEscaper} between the specified values (inclusive).</p>
+ * Constructs a {@code NumericEntityEscaper} between the specified values (inclusive).
*
* @param codepointLow above which to escape
* @param codepointHigh below which to escape
@@ -86,7 +88,7 @@ public class NumericEntityEscaper extends CodePointTranslator {
}
/**
- * <p>Constructs a {@code NumericEntityEscaper} outside of the specified values (exclusive).</p>
+ * Constructs a {@code NumericEntityEscaper} outside of the specified values (exclusive).
*
* @param codepointLow below which to escape
* @param codepointHigh above which to escape
diff --git a/src/main/java/org/apache/commons/text/translate/OctalUnescaper.java b/src/main/java/org/apache/commons/text/translate/OctalUnescaper.java
index 28bea8c..626ca41 100644
--- a/src/main/java/org/apache/commons/text/translate/OctalUnescaper.java
+++ b/src/main/java/org/apache/commons/text/translate/OctalUnescaper.java
@@ -60,7 +60,8 @@ public class OctalUnescaper extends CharSequenceTranslator {
}
/**
- * Checks if the given char is an octal digit. Octal digits are the character representations of the digits 0 to 7.
+ * Tests if the given char is an octal digit. Octal digits are the character representations of the digits 0 to 7.
+ *
* @param ch the char to check
* @return true if the given char is the character representation of one of the digits from 0 to 7
*/
@@ -69,7 +70,8 @@ public class OctalUnescaper extends CharSequenceTranslator {
}
/**
- * Checks if the given char is the character representation of one of the digit from 0 to 3.
+ * Tests if the given char is the character representation of one of the digit from 0 to 3.
+ *
* @param ch the char to check
* @return true if the given char is the character representation of one of the digits from 0 to 3
*/
diff --git a/src/main/java/org/apache/commons/text/translate/SinglePassTranslator.java b/src/main/java/org/apache/commons/text/translate/SinglePassTranslator.java
index 2c9f00f..d9f0012 100644
--- a/src/main/java/org/apache/commons/text/translate/SinglePassTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/SinglePassTranslator.java
@@ -48,7 +48,7 @@ abstract class SinglePassTranslator extends CharSequenceTranslator {
}
/**
- * Translate whole set of code points passed in input.
+ * Translates whole set of code points passed in input.
*
* @param input CharSequence that is being translated
* @param writer Writer to translate the text to
diff --git a/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java b/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java
index 3c98812..488ccc4 100644
--- a/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java
+++ b/src/main/java/org/apache/commons/text/translate/UnicodeEscaper.java
@@ -34,18 +34,18 @@ public class UnicodeEscaper extends CodePointTranslator {
private final boolean between;
/**
- * <p>Constructs a {@code UnicodeEscaper} for all characters.
- * </p>
+ * Constructs a {@code UnicodeEscaper} for all characters.
+ *
*/
public UnicodeEscaper() {
this(0, Integer.MAX_VALUE, true);
}
/**
- * <p>Constructs a {@code UnicodeEscaper} for the specified range. This is
+ * Constructs a {@code UnicodeEscaper} for the specified range. This is
* the underlying method for the other constructors/builders. The {@code below}
* and {@code above} boundaries are inclusive when {@code between} is
- * {@code true} and exclusive when it is {@code false}.</p>
+ * {@code true} and exclusive when it is {@code false}.
*
* @param below int value representing the lowest codepoint boundary
* @param above int value representing the highest codepoint boundary
@@ -58,7 +58,7 @@ public class UnicodeEscaper extends CodePointTranslator {
}
/**
- * <p>Constructs a {@code UnicodeEscaper} below the specified value (exclusive).</p>
+ * Constructs a {@code UnicodeEscaper} below the specified value (exclusive).
*
* @param codepoint below which to escape
* @return The newly created {@code UnicodeEscaper} instance
@@ -68,7 +68,7 @@ public class UnicodeEscaper extends CodePointTranslator {
}
/**
- * <p>Constructs a {@code UnicodeEscaper} above the specified value (exclusive).</p>
+ * Constructs a {@code UnicodeEscaper} above the specified value (exclusive).
*
* @param codepoint above which to escape
* @return The newly created {@code UnicodeEscaper} instance
@@ -78,7 +78,7 @@ public class UnicodeEscaper extends CodePointTranslator {
}
/**
- * <p>Constructs a {@code UnicodeEscaper} outside of the specified values (exclusive).</p>
+ * Constructs a {@code UnicodeEscaper} outside of the specified values (exclusive).
*
* @param codepointLow below which to escape
* @param codepointHigh above which to escape
@@ -89,7 +89,7 @@ public class UnicodeEscaper extends CodePointTranslator {
}
/**
- * <p>Constructs a {@code UnicodeEscaper} between the specified values (inclusive).</p>
+ * Constructs a {@code UnicodeEscaper} between the specified values (inclusive).
*
* @param codepointLow above which to escape
* @param codepointHigh below which to escape