|
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.ByteRange
This class represents ranges of consecutive byte 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 | |
ByteRange(byte first,
byte last)
Creates a new range of consecutive byte values. |
Method Summary | |
boolean |
adjacentTo(ByteRange range)
Indicates whether this range is adjacent to a specified range. |
boolean |
canMergeWith(ByteRange 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(byte 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. |
byte |
first()
Returns the first byte value in this range. |
int |
hashCode()
Returns a hash code value for this range. |
int |
intersectionLength(ByteRange range)
Returns the length of the intersection between this range and a specified range. |
boolean |
intersects(ByteRange range)
Indicates whether this range intersects a specified range. |
byte |
last()
Returns the last byte value in this range. |
int |
length()
Returns the number of values in this range. |
ByteRange |
mergeWith(ByteRange range)
Creates a new range as a merge between this range and a specified range. |
String |
toString()
Returns a string representation of this range. |
ByteRange |
tryMergeWith(ByteRange range)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ByteRange(byte first, byte last)
first
- the first byte value in the range.last
- the last byte value in the range.
IllegalArgumentException
- if first > last.Method Detail |
public byte first()
public byte last()
public int length()
public boolean intersects(ByteRange range)
range
- the range with which to compare this range.
NullPointerException
- if range is null.public boolean adjacentTo(ByteRange range)
range
- the range with which to compare this range.
NullPointerException
- if range is null.public boolean canMergeWith(ByteRange range)
range
- the range to merge with.
NullPointerException
- if range is null.public ByteRange mergeWith(ByteRange 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 ByteRange tryMergeWith(ByteRange range)
public int intersectionLength(ByteRange range)
range
- the range with which to intersect this rance.
NullPointerException
- if range is null.public boolean contains(byte 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 ByteRange.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 |