Javadoc
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1078015 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
48b657d4db
commit
ef14f844cc
|
@ -52,14 +52,14 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
private transient String iToString;
|
||||
|
||||
/**
|
||||
* <p>Constructs a <code>CharRange</code> over a set of characters,
|
||||
* <p>Constructs a {@code CharRange} over a set of characters,
|
||||
* optionally negating the range.</p>
|
||||
*
|
||||
* <p>A negated range includes everything except that defined by the
|
||||
* start and end characters.</p>
|
||||
*
|
||||
* <p>If start and end are in the wrong order, they are reversed.
|
||||
* Thus <code>a-e</code> is the same as <code>e-a</code>.</p>
|
||||
* Thus {@code a-e} is the same as {@code e-a}.</p>
|
||||
*
|
||||
* @param start first character, inclusive, in this range
|
||||
* @param end last character, inclusive, in this range
|
||||
|
@ -79,7 +79,7 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Constructs a <code>CharRange</code> over a single character.</p>
|
||||
* <p>Constructs a {@code CharRange} over a single character.</p>
|
||||
*
|
||||
* @param ch only character in this range
|
||||
* @return the new CharRange object
|
||||
|
@ -91,7 +91,7 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Constructs a negated <code>CharRange</code> over a single character.</p>
|
||||
* <p>Constructs a negated {@code CharRange} over a single character.</p>
|
||||
*
|
||||
* @param ch only character in this range
|
||||
* @return the new CharRange object
|
||||
|
@ -103,7 +103,7 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Constructs a <code>CharRange</code> over a set of characters.</p>
|
||||
* <p>Constructs a {@code CharRange} over a set of characters.</p>
|
||||
*
|
||||
* @param start first character, inclusive, in this range
|
||||
* @param end last character, inclusive, in this range
|
||||
|
@ -116,7 +116,7 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Constructs a negated <code>CharRange</code> over a set of characters.</p>
|
||||
* <p>Constructs a negated {@code CharRange} over a set of characters.</p>
|
||||
*
|
||||
* @param start first character, inclusive, in this range
|
||||
* @param end last character, inclusive, in this range
|
||||
|
@ -149,12 +149,12 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Is this <code>CharRange</code> negated.</p>
|
||||
* <p>Is this {@code CharRange} negated.</p>
|
||||
*
|
||||
* <p>A negated range includes everything except that defined by the
|
||||
* start and end characters.</p>
|
||||
*
|
||||
* @return <code>true</code> is negated
|
||||
* @return {@code true} if negated
|
||||
*/
|
||||
public boolean isNegated() {
|
||||
return negated;
|
||||
|
@ -166,7 +166,7 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
* <p>Is the character specified contained in this range.</p>
|
||||
*
|
||||
* @param ch the character to check
|
||||
* @return <code>true</code> if this range contains the input character
|
||||
* @return {@code true} if this range contains the input character
|
||||
*/
|
||||
public boolean contains(char ch) {
|
||||
return (ch >= start && ch <= end) != negated;
|
||||
|
@ -177,8 +177,8 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
* this range.</p>
|
||||
*
|
||||
* @param range the range to check against
|
||||
* @return <code>true</code> if this range entirely contains the input range
|
||||
* @throws IllegalArgumentException if <code>null</code> input
|
||||
* @return {@code true} if this range entirely contains the input range
|
||||
* @throws IllegalArgumentException if {@code null} input
|
||||
*/
|
||||
public boolean contains(CharRange range) {
|
||||
if (range == null) {
|
||||
|
@ -324,7 +324,7 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
/**
|
||||
* Has the iterator not reached the end character yet?
|
||||
*
|
||||
* @return <code>true</code> if the iterator has yet to reach the character date
|
||||
* @return {@code true} if the iterator has yet to reach the character date
|
||||
*/
|
||||
public boolean hasNext() {
|
||||
return hasNext;
|
||||
|
@ -333,7 +333,7 @@ public final class CharRange implements Iterable<Character>, Serializable {
|
|||
/**
|
||||
* Return the next character in the iteration
|
||||
*
|
||||
* @return <code>Character</code> for the next character
|
||||
* @return {@code Character} for the next character
|
||||
*/
|
||||
public Character next() {
|
||||
if (hasNext == false) {
|
||||
|
|
|
@ -100,7 +100,7 @@ public class CharSet implements Serializable {
|
|||
* <p>Factory method to create a new CharSet using a special syntax.</p>
|
||||
*
|
||||
* <ul>
|
||||
* <li><code>null</code> or empty string ("")
|
||||
* <li>{@code null} or empty string ("")
|
||||
* - set containing no characters</li>
|
||||
* <li>Single character, such as "a"
|
||||
* - set containing just that character</li>
|
||||
|
@ -179,7 +179,7 @@ public class CharSet implements Serializable {
|
|||
* Each string is merged in with the set.</p>
|
||||
*
|
||||
* @param set Strings to merge into the initial set
|
||||
* @throws NullPointerException if set is <code>null</code>
|
||||
* @throws NullPointerException if set is {@code null}
|
||||
*/
|
||||
protected CharSet(String[] set) {
|
||||
super();
|
||||
|
@ -191,7 +191,7 @@ public class CharSet implements Serializable {
|
|||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Add a set definition string to the <code>CharSet</code>.</p>
|
||||
* <p>Add a set definition string to the {@code CharSet}.</p>
|
||||
*
|
||||
* @param str set definition string
|
||||
*/
|
||||
|
@ -237,11 +237,11 @@ public class CharSet implements Serializable {
|
|||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Does the <code>CharSet</code> contain the specified
|
||||
* character <code>ch</code>.</p>
|
||||
* <p>Does the {@code CharSet} contain the specified
|
||||
* character {@code ch}.</p>
|
||||
*
|
||||
* @param ch the character to check for
|
||||
* @return <code>true</code> if the set contains the characters
|
||||
* @return {@code true} if the set contains the characters
|
||||
*/
|
||||
public boolean contains(char ch) {
|
||||
for (CharRange range : set) {
|
||||
|
@ -255,10 +255,10 @@ public class CharSet implements Serializable {
|
|||
// Basics
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Compares two CharSet objects, returning true if they represent
|
||||
* <p>Compares two {@code CharSet} objects, returning true if they represent
|
||||
* exactly the same set of characters defined in the same way.</p>
|
||||
*
|
||||
* <p>The two sets <code>abc</code> and <code>a-c</code> are <i>not</i>
|
||||
* <p>The two sets {@code abc} and {@code a-c} are <i>not</i>
|
||||
* equal according to this method.</p>
|
||||
*
|
||||
* @param obj the object to compare to
|
||||
|
@ -278,9 +278,9 @@ public class CharSet implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* <p>Gets a hashCode compatible with the equals method.</p>
|
||||
* <p>Gets a hash code compatible with the equals method.</p>
|
||||
*
|
||||
* @return a suitable hashCode
|
||||
* @return a suitable hash code
|
||||
* @since 2.0
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
package org.apache.commons.lang3;
|
||||
|
||||
/**
|
||||
* <p>Operations on <code>CharSet</code>s.</p>
|
||||
* <p>Operations on {@code CharSet} instances.</p>
|
||||
*
|
||||
* <p>This class handles <code>null</code> input gracefully.
|
||||
* An exception will not be thrown for a <code>null</code> input.
|
||||
* <p>This class handles {@code null} input gracefully.
|
||||
* An exception will not be thrown for a {@code null} input.
|
||||
* Each method documents its behaviour in more detail.</p>
|
||||
*
|
||||
* <p>#ThreadSafe#</p>
|
||||
|
@ -35,7 +35,7 @@ public class CharSetUtils {
|
|||
|
||||
/**
|
||||
* <p>CharSetUtils instances should NOT be constructed in standard programming.
|
||||
* Instead, the class should be used as <code>CharSetUtils.evaluateSet(null);</code>.</p>
|
||||
* Instead, the class should be used as {@code CharSetUtils.evaluateSet(null);}.</p>
|
||||
*
|
||||
* <p>This constructor is public to permit tools that require a JavaBean instance
|
||||
* to operate.</p>
|
||||
|
@ -62,7 +62,7 @@ public class CharSetUtils {
|
|||
* @see CharSet#getInstance(java.lang.String) for set-syntax.
|
||||
* @param str the string to squeeze, may be null
|
||||
* @param set the character set to use for manipulation, may be null
|
||||
* @return modified String, <code>null</code> if null string input
|
||||
* @return the modified String, {@code null} if null string input
|
||||
*/
|
||||
public static String squeeze(String str, String set) {
|
||||
if (StringUtils.isEmpty(str) || StringUtils.isEmpty(set)) {
|
||||
|
@ -85,7 +85,7 @@ public class CharSetUtils {
|
|||
* @see CharSet#getInstance(java.lang.String) for set-syntax.
|
||||
* @param str the string to squeeze, may be null
|
||||
* @param set the character set to use for manipulation, may be null
|
||||
* @return modified String, <code>null</code> if null string input
|
||||
* @return the modified String, {@code null} if null string input
|
||||
*/
|
||||
public static String squeeze(String str, String[] set) {
|
||||
if (StringUtils.isEmpty(str) || ArrayUtils.isEmpty(set)) {
|
||||
|
@ -128,7 +128,7 @@ public class CharSetUtils {
|
|||
* @see CharSet#getInstance(java.lang.String) for set-syntax.
|
||||
* @param str String to count characters in, may be null
|
||||
* @param set String set of characters to count, may be null
|
||||
* @return character count, zero if null string input
|
||||
* @return the character count, zero if null string input
|
||||
*/
|
||||
public static int count(String str, String set) {
|
||||
if (StringUtils.isEmpty(str) || StringUtils.isEmpty(set)) {
|
||||
|
@ -151,7 +151,7 @@ public class CharSetUtils {
|
|||
* @see CharSet#getInstance(java.lang.String) for set-syntax.
|
||||
* @param str String to count characters in, may be null
|
||||
* @param set String[] set of characters to count, may be null
|
||||
* @return character count, zero if null string input
|
||||
* @return the character count, zero if null string input
|
||||
*/
|
||||
public static int count(String str, String[] set) {
|
||||
if (StringUtils.isEmpty(str) || ArrayUtils.isEmpty(set)) {
|
||||
|
@ -187,7 +187,7 @@ public class CharSetUtils {
|
|||
* @see CharSet#getInstance(java.lang.String) for set-syntax.
|
||||
* @param str String to keep characters from, may be null
|
||||
* @param set String set of characters to keep, may be null
|
||||
* @return modified String, <code>null</code> if null string input
|
||||
* @return the modified String, {@code null} if null string input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static String keep(String str, String set) {
|
||||
|
@ -215,7 +215,7 @@ public class CharSetUtils {
|
|||
* @see CharSet#getInstance(java.lang.String) for set-syntax.
|
||||
* @param str String to keep characters from, may be null
|
||||
* @param set String[] set of characters to keep, may be null
|
||||
* @return modified String, <code>null</code> if null string input
|
||||
* @return the modified String, {@code null} if null string input
|
||||
* @since 2.0
|
||||
*/
|
||||
public static String keep(String str, String[] set) {
|
||||
|
@ -246,7 +246,7 @@ public class CharSetUtils {
|
|||
* @see CharSet#getInstance(java.lang.String) for set-syntax.
|
||||
* @param str String to delete characters from, may be null
|
||||
* @param set String set of characters to delete, may be null
|
||||
* @return modified String, <code>null</code> if null string input
|
||||
* @return the modified String, {@code null} if null string input
|
||||
*/
|
||||
public static String delete(String str, String set) {
|
||||
if (StringUtils.isEmpty(str) || StringUtils.isEmpty(set)) {
|
||||
|
@ -270,7 +270,7 @@ public class CharSetUtils {
|
|||
* @see CharSet#getInstance(java.lang.String) for set-syntax.
|
||||
* @param str String to delete characters from, may be null
|
||||
* @param set String[] set of characters to delete, may be null
|
||||
* @return modified String, <code>null</code> if null string input
|
||||
* @return the modified String, {@code null} if null string input
|
||||
*/
|
||||
public static String delete(String str, String[] set) {
|
||||
if (StringUtils.isEmpty(str) || ArrayUtils.isEmpty(set)) {
|
||||
|
@ -286,7 +286,7 @@ public class CharSetUtils {
|
|||
* @param str String to modify characters within
|
||||
* @param set String[] set of characters to modify
|
||||
* @param expect whether to evaluate on match, or non-match
|
||||
* @return modified String
|
||||
* @return the modified String, not null
|
||||
*/
|
||||
private static String modify(String str, String[] set, boolean expect) {
|
||||
CharSet chars = CharSet.getInstance(set);
|
||||
|
|
Loading…
Reference in New Issue