|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbak.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 Form| Constructor 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 LongSortedSetadd in class AbstractLongCollectionpublic LongIterator iterator()
LongCollection
iterator in interface LongCollectionpublic long first()
LongSortedSet
first in interface LongSortedSetpublic long last()
LongSortedSet
last in interface LongSortedSetpublic LongSortedSet headSet(long to)
LongSortedSet
headSet in interface LongSortedSetto - the upper bound of the returned set (not included).public LongSortedSet tailSet(long from)
LongSortedSet
tailSet in interface LongSortedSetfrom - the lower bound of the returned set (included).
public LongSortedSet subSet(long from,
long to)
LongSortedSet
subSet in interface LongSortedSetfrom - 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 AbstractLongCollectionpublic void trimToSize()
LongCollection
trimToSize in interface LongCollectiontrimToSize in class AbstractLongCollectionpublic Object clone()
public void clear()
LongCollection
clear in interface LongCollectionclear in class AbstractLongCollectionpublic boolean contains(long v)
LongCollection
contains in interface LongCollectioncontains in class AbstractLongCollectionpublic int hashCode()
LongCollection
hashCode in interface LongCollectionhashCode in class AbstractLongSetpublic boolean isEmpty()
LongCollection
isEmpty in interface LongCollectionisEmpty in class AbstractLongCollectionpublic int size()
LongCollection
size in interface LongCollectionsize in class AbstractLongCollectionpublic boolean remove(long v)
LongCollection
remove in interface LongCollectionremove in class AbstractLongCollectionpublic long[] toArray(long[] a)
LongCollection
toArray in interface LongCollectiontoArray in class AbstractLongCollectionpublic 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 | |||||||||