|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rubecula.util.Range
Class for handling ranges of integers.
Field Summary | |
protected int |
_End
The end of the range. |
protected int |
_Start
The start of the range. |
static Range |
$ALL
|
static Range |
$NEG
|
static Range |
$NONNEG
|
static Range |
$NONPOS
|
static Range |
$POS
|
static Range |
$ZERO
|
Constructor Summary | |
Range(int start)
Construct a single-valued range from start to start. |
|
Range(int start,
int end)
Construct a range from start to end. |
Method Summary | |
int |
getEnd()
Method to get the end of this Range. |
int |
getStart()
Method to get the start of this Range. |
boolean |
includes(int value)
Determine whether this range includes the value given. |
Range |
intersection(Range that)
Yield the intersection of this range and that range. |
boolean |
isValid()
Method to determine if this range is valid, i.e. non-empty. |
int |
length()
Get the length of this Range. |
java.lang.String |
substring(java.lang.String source)
Yield a substring of the source by including only those characters whose positions in the string correspond to valid values in this range. |
Range |
union(Range that)
Yield the union of this range and that range. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Range $POS
public static final Range $NEG
public static final Range $ZERO
public static final Range $NONNEG
public static final Range $NONPOS
public static final Range $ALL
protected final int _Start
protected final int _End
Constructor Detail |
public Range(int start, int end)
start
- the first valid integer in the range.end
- the last valid integer in the range.public Range(int start)
start
- the only valid integer in the range.Method Detail |
public boolean includes(int value)
value
- the integer to be tested against the range.
public java.lang.String substring(java.lang.String source)
source
- the string to be substringed.
public boolean isValid()
public Range intersection(Range that)
that
- a range which is to be intersected with this.
public Range union(Range that)
that
- a range which is to be unioned with this.
public int length()
public int getStart()
public int getEnd()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |