|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ace.range.SortedRangeSet
public class SortedRangeSet
Collection that stores a sorted set of ranges and is able to represent them as a string.
Field Summary | |
---|---|
static SortedRangeSet |
FULL_SET
A static set which contains all possible values. |
Constructor Summary | |
---|---|
SortedRangeSet(long[] items)
Creates a new instance from an array of longs. |
|
SortedRangeSet(String representation)
Creates a new instance from a string representation. |
Method Summary | |
---|---|
boolean |
contains(long number)
Checks if a number falls within any range in this set. |
SortedRangeSet |
diffDest(SortedRangeSet dest)
Creates the difference between this set and dest , by (in set notation)result = dest \ this ,that is, if dest = {1, 2} and this = {2, 3} , then
result = {1, 2} \ {2, 3} = {1} |
long |
getHigh()
Returns the highest value present in any of the ranges in this SortredRangeSet . |
RangeIterator |
iterator()
Returns an iterator that iterates over all the ranges in this set. |
String |
toRepresentation()
Retrieve a string representation of the SortedRangeSet . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final SortedRangeSet FULL_SET
Constructor Detail |
---|
public SortedRangeSet(String representation)
representation
- The string representation of a SortedRangeSet
.
NumberFormatException
- If the string representation does not contain a valid SortedRangeSet
.public SortedRangeSet(long[] items)
items
- Array of longsMethod Detail |
---|
public String toRepresentation()
SortedRangeSet
.
SortedRangeSet
.public SortedRangeSet diffDest(SortedRangeSet dest)
dest
, by (in set notation)result = dest \ this
,dest = {1, 2}
and this = {2, 3}
, then
result = {1, 2} \ {2, 3} = {1}
dest
- The set from which this set should be 'set-minussed'.
public boolean contains(long number)
number
- the number to check
true
if the number was inside any range in this setpublic RangeIterator iterator()
public long getHigh()
SortredRangeSet
.
SortredRangeSet
or 0
if the SortedRangeSet
is empty.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |