public class CharRange extends Range
Note, many methods in this particular class have the same signatures as in the apache commons.lang package but the implementation was strictly clean-room.
Thread Safety: This class is not thread safe in the face of any concurrent modification (via changing the start/end chars or union/intersection operations).
Constructor and Description |
---|
CharRange(char start,
char end)
Constructs a character range between the specified
start and end chars (both inclusive).
|
Modifier and Type | Method and Description |
---|---|
char |
getEnd()
Get the end character for this character range.
|
char |
getStart()
Get the start character for this character range
|
boolean |
inRange(char c)
Is the passed in character inside this range
|
static void |
main(String[] args) |
void |
setEnd(char c)
Sets the end character for this character range
|
void |
setStart(char c)
Set the start character for this character range
|
String |
toString()
Output a string representation of the character range
|
isNegated, setNegated
public CharRange(char start, char end)
IllegalArgumentException
- if the end char is lesser (via a < comparison)
than the start char (equal to the start char is ok)public char getStart()
public char getEnd()
public boolean inRange(char c)
public void setEnd(char c)
c
- the end charIllegalArgumentException
- if the end char is lesser (via a < comparison)
than the current start char (equal to the start char is
ok)public void setStart(char c)
IllegalArgumentException
- if the start char is greater (via a > comparison)
than the current end char (equal to the end char is
ok)