|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.lang.CharRange
A contiguous range of characters, optionally negated.
Instances are immutable.
Constructor Summary | |
CharRange(char ch)
Constructs a CharRange over a single character. |
|
CharRange(char ch,
boolean negated)
Constructs a CharRange over a single character,
optionally negating the range. |
|
CharRange(char start,
char end)
Constructs a CharRange over a set of characters. |
|
CharRange(char start,
char end,
boolean negated)
Constructs a CharRange over a set of characters,
optionally negating the range. |
Method Summary | |
boolean |
contains(char ch)
Is the character specified contained in this range. |
boolean |
contains(CharRange range)
Are all the characters of the passed in range contained in this range. |
boolean |
equals(Object obj)
Compares two CharRange objects, returning true if they represent exactly the same range of characters defined in the same way. |
char |
getEnd()
Gets the end character for this character range. |
char |
getStart()
Gets the start character for this character range. |
int |
hashCode()
Gets a hashCode compatable with the equals method. |
boolean |
isNegated()
Is this CharRange negated. |
String |
toString()
Gets a string representation of the character range. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public CharRange(char ch)
Constructs a CharRange
over a single character.
ch
- only character in this rangepublic CharRange(char ch, boolean negated)
Constructs a CharRange
over a single character,
optionally negating the range.
A negated range includes everything except the specified char.
ch
- only character in this rangenegated
- true to express everything except the rangepublic CharRange(char start, char end)
Constructs a CharRange
over a set of characters.
start
- first character, inclusive, in this rangeend
- last character, inclusive, in this rangepublic CharRange(char start, char end, boolean negated)
Constructs a CharRange
over 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-e
is the same as e-a
.
start
- first character, inclusive, in this rangeend
- last character, inclusive, in this rangenegated
- true to express everything except the rangeMethod Detail |
public char getStart()
Gets the start character for this character range.
public char getEnd()
Gets the end character for this character range.
public boolean isNegated()
Is this CharRange
negated.
A negated range includes everything except that defined by the start and end characters.
true
is negatedpublic boolean contains(char ch)
Is the character specified contained in this range.
ch
- the character to check
true
if this range contains the input characterpublic boolean contains(CharRange range)
Are all the characters of the passed in range contained in this range.
range
- the range to check against
true
if this range entirely contains the input range
IllegalArgumentException
- if null
inputpublic boolean equals(Object obj)
Compares two CharRange objects, returning true if they represent exactly the same range of characters defined in the same way.
obj
- the object to compare to
public int hashCode()
Gets a hashCode compatable with the equals method.
public String toString()
Gets a string representation of the character range.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |