|
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.AbstractLongCollection bak.pcj.set.AbstractLongSet bak.pcj.set.LongRangeSet
This class represents range based sets of long values. The implementation is optimized for cases where most set elements fall into ranges of consecutive long values.
Implementation of LongSortedSet is supported from PCJ 1.2. Prior to 1.2, only LongSet was implemented.
LongRange
,
Serialized FormConstructor Summary | |
LongRangeSet()
Creates a new empty range set. |
|
LongRangeSet(long[] a)
Creates a new empty range set containing specified values. |
|
LongRangeSet(LongCollection c)
Creates a new range set with the same elements as a specified collection. |
Method Summary | |
boolean |
add(long v)
Adds an element to this set. |
boolean |
addAll(long[] a)
Adds an array of long values to this set. |
boolean |
addAll(long first,
long last)
Adds a specified range to this set. |
boolean |
addAll(LongRange range)
Adds a specified range to this set. |
boolean |
addAll(LongRangeSet c)
Adds all the elements of a specified range set to this set. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this range set. |
boolean |
contains(long v)
Indicates whether this collection contains a specified element. |
boolean |
containsAll(LongRange range)
Indicates whether all elements of a specified range is contained in this set. |
long |
first()
Returns the lowest element of this set. |
int |
hashCode()
Returns a hash code value for this collection. |
LongSortedSet |
headSet(long to)
Returns the subset of values lower than a specified value. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
LongIterator |
iterator()
Returns an iterator over this collection. |
long |
last()
Returns the highest element of this set. |
LongRange[] |
ranges()
Returns the ranges of this set. |
boolean |
remove(long v)
Removes a specified element from this collection. |
int |
size()
Returns the number of elements in this collection. |
LongSortedSet |
subSet(long from,
long to)
Returns the subset of values lower that a specified value and higher than or equal to another specified value. |
LongSortedSet |
tailSet(long from)
Returns the subset of values higher than or equal to a specified value. |
long[] |
toArray(long[] a)
Returns the elements of this collection as an array. |
String |
toString()
Returns a string representation of this collection. |
void |
trimToSize()
Minimizes the memory used by this collection. |
Methods inherited from class bak.pcj.set.AbstractLongSet |
equals |
Methods inherited from class bak.pcj.AbstractLongCollection |
addAll, containsAll, removeAll, retainAll, toArray |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface bak.pcj.LongCollection |
addAll, containsAll, equals, removeAll, retainAll, toArray |
Constructor Detail |
public LongRangeSet()
public LongRangeSet(long[] a)
a
- the values that the new set should contain.
NullPointerException
- if a is null.public LongRangeSet(LongCollection c)
c
- the collection whose elements to add to the new
set.
NullPointerException
- if c is null.Method Detail |
public boolean add(long v)
LongSortedSet
add
in interface LongSortedSet
add
in class AbstractLongCollection
public LongIterator iterator()
LongCollection
iterator
in interface LongCollection
public long first()
LongSortedSet
first
in interface LongSortedSet
public long last()
LongSortedSet
last
in interface LongSortedSet
public LongSortedSet headSet(long to)
LongSortedSet
headSet
in interface LongSortedSet
to
- the upper bound of the returned set (not included).public LongSortedSet tailSet(long from)
LongSortedSet
tailSet
in interface LongSortedSet
from
- the lower bound of the returned set (included).public LongSortedSet subSet(long from, long to)
LongSortedSet
subSet
in interface LongSortedSet
from
- the lower bound of the returned set (included).to
- the upper bound of the returned set (not included).public String toString()
AbstractLongCollection
toString
in class AbstractLongCollection
public void trimToSize()
LongCollection
trimToSize
in interface LongCollection
trimToSize
in class AbstractLongCollection
public Object clone()
public void clear()
LongCollection
clear
in interface LongCollection
clear
in class AbstractLongCollection
public boolean contains(long v)
LongCollection
contains
in interface LongCollection
contains
in class AbstractLongCollection
public int hashCode()
LongCollection
hashCode
in interface LongCollection
hashCode
in class AbstractLongSet
public boolean isEmpty()
LongCollection
isEmpty
in interface LongCollection
isEmpty
in class AbstractLongCollection
public int size()
LongCollection
size
in interface LongCollection
size
in class AbstractLongCollection
public boolean remove(long v)
LongCollection
remove
in interface LongCollection
remove
in class AbstractLongCollection
public long[] toArray(long[] a)
LongCollection
toArray
in interface LongCollection
toArray
in class AbstractLongCollection
public boolean containsAll(LongRange range)
range
- the range whose elements to test for
containment.
NullPointerException
- if range is null.AbstractLongCollection.containsAll(LongCollection)
public boolean addAll(LongRangeSet c)
c
- the set whose elements to add to this
set.
NullPointerException
- if c is null.add(long)
,
addAll(LongRange)
,
AbstractLongCollection.addAll(LongCollection)
,
addAll(long, long)
,
addAll(long[])
public boolean addAll(LongRange range)
range
- the range to add to this set.
NullPointerException
- if range is null.add(long)
,
addAll(LongRangeSet)
,
AbstractLongCollection.addAll(LongCollection)
,
addAll(long, long)
,
addAll(long[])
public boolean addAll(long first, long last)
first
- the first value of the range to add to this set.last
- the last value of the range to add to this set.
IllegalArgumentException
- if first > last.public boolean addAll(long[] a)
a
- the array of long values to add to this set.
NullPointerException
- if a is null.add(long)
,
addAll(LongRange)
,
addAll(LongRangeSet)
,
AbstractLongCollection.addAll(LongCollection)
,
addAll(long, long)
public LongRange[] ranges()
|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |