Class CharRange
- All Implemented Interfaces:
Serializable
A contiguous range of characters, optionally negated.
Instances are immutable.
#ThreadSafe#
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCharRange(char ch) Deprecated.Constructs aCharRangeover a single character.CharRange(char ch, boolean negated) Deprecated.Constructs aCharRangeover a single character, optionally negating the range.CharRange(char start, char end) Deprecated.Constructs aCharRangeover a set of characters.CharRange(char start, char end, boolean negated) Deprecated.Constructs aCharRangeover a set of characters, optionally negating the range. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(char ch) Deprecated.Is the character specified contained in this range.booleanDeprecated.Are all the characters of the passed in range contained in this range.booleanDeprecated.Compares two CharRange objects, returning true if they represent exactly the same range of characters defined in the same way.chargetEnd()Deprecated.Gets the end character for this character range.chargetStart()Deprecated.Gets the start character for this character range.inthashCode()Deprecated.Gets a hashCode compatible with the equals method.static CharRangeis(char ch) Deprecated.Constructs aCharRangeover a single character.static CharRangeisIn(char start, char end) Deprecated.Constructs aCharRangeover a set of characters.booleanDeprecated.Is thisCharRangenegated.static CharRangeisNot(char ch) Deprecated.Constructs a negatedCharRangeover a single character.static CharRangeisNotIn(char start, char end) Deprecated.Constructs a negatedCharRangeover a set of characters.iterator()Deprecated.Returns an iterator which can be used to walk through the characters described by this range.toString()Deprecated.Gets a string representation of the character range.
-
Constructor Details
-
CharRange
public CharRange(char ch) Deprecated.Constructs a
CharRangeover a single character.- Parameters:
ch- only character in this range
-
CharRange
public CharRange(char ch, boolean negated) Deprecated.Constructs a
CharRangeover a single character, optionally negating the range.A negated range includes everything except the specified char.
- Parameters:
ch- only character in this rangenegated- true to express everything except the range
-
CharRange
public CharRange(char start, char end) Deprecated.Constructs a
CharRangeover a set of characters.- Parameters:
start- first character, inclusive, in this rangeend- last character, inclusive, in this range
-
CharRange
public CharRange(char start, char end, boolean negated) Deprecated.Constructs a
CharRangeover a set of characters, optionally negating the range.A negated range includes everything except that defined by the start and end characters.
If start and end are in the wrong order, they are reversed. Thus
a-eis the same ase-a.- Parameters:
start- first character, inclusive, in this rangeend- last character, inclusive, in this rangenegated- true to express everything except the range
-
-
Method Details
-
is
Deprecated.Constructs a
CharRangeover a single character.- Parameters:
ch- only character in this range- Returns:
- the new CharRange object
- Since:
- 2.5
- See Also:
-
isNot
Deprecated.Constructs a negated
CharRangeover a single character.- Parameters:
ch- only character in this range- Returns:
- the new CharRange object
- Since:
- 2.5
- See Also:
-
isIn
Deprecated.Constructs a
CharRangeover a set of characters.- Parameters:
start- first character, inclusive, in this rangeend- last character, inclusive, in this range- Returns:
- the new CharRange object
- Since:
- 2.5
- See Also:
-
isNotIn
Deprecated.Constructs a negated
CharRangeover a set of characters.- Parameters:
start- first character, inclusive, in this rangeend- last character, inclusive, in this range- Returns:
- the new CharRange object
- Since:
- 2.5
- See Also:
-
getStart
public char getStart()Deprecated.Gets the start character for this character range.
- Returns:
- the start char (inclusive)
-
getEnd
public char getEnd()Deprecated.Gets the end character for this character range.
- Returns:
- the end char (inclusive)
-
isNegated
public boolean isNegated()Deprecated.Is this
CharRangenegated.A negated range includes everything except that defined by the start and end characters.
- Returns:
trueis negated
-
contains
public boolean contains(char ch) Deprecated.Is the character specified contained in this range.
- Parameters:
ch- the character to check- Returns:
trueif this range contains the input character
-
contains
Deprecated.Are all the characters of the passed in range contained in this range.
- Parameters:
range- the range to check against- Returns:
trueif this range entirely contains the input range- Throws:
IllegalArgumentException- ifnullinput
-
equals
Deprecated.Compares two CharRange objects, returning true if they represent exactly the same range of characters defined in the same way.
-
hashCode
public int hashCode()Deprecated.Gets a hashCode compatible with the equals method.
-
toString
Deprecated.Gets a string representation of the character range.
-
iterator
Deprecated.Returns an iterator which can be used to walk through the characters described by this range.
#NotThreadSafe# the iterator is not threadsafe
- Returns:
- an iterator to the chars represented by this range
- Since:
- 2.5
-