|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bak.pcj.set.CharRange
This class represents ranges of consecutive char values.
Design note: Empty ranges cannot exist. It gives too many problems defining adjacency and intersections, and empty ranges are not really useful for their purpose of backing up range sets. It also removes the problem of overflow checking.
Constructor Summary | |
CharRange(char first,
char last)
Creates a new range of consecutive char values. |
Method Summary | |
boolean |
adjacentTo(CharRange range)
Indicates whether this range is adjacent to a specified range. |
boolean |
canMergeWith(CharRange range)
Indicates whether this can be merged with a specified range. |
int |
compareTo(Object obj)
Compares this range with some object for order. |
boolean |
contains(char v)
Indicates whether a specified value is a member of this range. |
boolean |
equals(Object obj)
Indicates whether this range is equal to some object. |
char |
first()
Returns the first char value in this range. |
int |
hashCode()
Returns a hash code value for this range. |
int |
intersectionLength(CharRange range)
Returns the length of the intersection between this range and a specified range. |
boolean |
intersects(CharRange range)
Indicates whether this range intersects a specified range. |
char |
last()
Returns the last char value in this range. |
int |
length()
Returns the number of values in this range. |
CharRange |
mergeWith(CharRange range)
Creates a new range as a merge between this range and a specified range. |
String |
toString()
Returns a string representation of this range. |
CharRange |
tryMergeWith(CharRange range)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public CharRange(char first, char last)
first
- the first char value in the range.last
- the last char value in the range.
IllegalArgumentException
- if first > last.Method Detail |
public char first()
public char last()
public int length()
public boolean intersects(CharRange range)
range
- the range with which to compare this range.
NullPointerException
- if range is null.public boolean adjacentTo(CharRange range)
range
- the range with which to compare this range.
NullPointerException
- if range is null.public boolean canMergeWith(CharRange range)
range
- the range to merge with.
NullPointerException
- if range is null.public CharRange mergeWith(CharRange range)
range
- the range with which to merge this range.
NullPointerException
- if range is null.
IllegalArgumentException
- if this range cannot be merged with the specified
range.public CharRange tryMergeWith(CharRange range)
public int intersectionLength(CharRange range)
range
- the range with which to intersect this rance.
NullPointerException
- if range is null.public boolean contains(char v)
v
- the value to test for membership.
public boolean equals(Object obj)
obj
- the object with which to compare this range.
public int compareTo(Object obj)
compareTo
in interface Comparable
obj
- the object with which to compare this range.
NullPointerException
- if obj is null.
ClassCastException
- if obj is not of class CharRange.public int hashCode()
public String toString()
|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |