|
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.AbstractIntCollection
bak.pcj.set.AbstractIntSet
bak.pcj.set.IntBitSet
This class represents bit array based sets of int values. When a bit in the underlying array is set, the value having the same number as the bit is contained in the array. This implies that bit sets cannot contain negative values.
Implementation of IntSortedSet is supported from PCJ 1.2. Prior to 1.2, only IntSet was implemented.
Note: There is no growth policy involved with bit sets. The number of bits to use depends on the value of the largest element and not the size of the set. While sizes are predictable (they grow), a new maximum element is generally not predictable making it meaningless to grow the array at a specific rate.
| Constructor Summary | |
IntBitSet()
Creates a new empty bit set with a capacity of 64. |
|
IntBitSet(int maximum)
Creates a new bit set with a specified maximum value. |
|
IntBitSet(int[] a)
Creates a new bit set with the same elements as the specified array. |
|
IntBitSet(IntCollection c)
Creates a new bit set with the same elements as the specified collection. |
|
| Method Summary | |
boolean |
add(int value)
Adds an element to this set. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this bit set. |
boolean |
contains(int value)
Indicates whether this collection contains a specified element. |
void |
ensureCapacity(int maximum)
Ensures that this bit set can contain a specified maximum element without increasing the capacity. |
int |
first()
Returns the lowest element of this set. |
IntSortedSet |
headSet(int to)
Returns the subset of values lower than a specified value. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
IntIterator |
iterator()
Returns an iterator over this collection. |
int |
last()
Returns the highest element of this set. |
boolean |
remove(int value)
Removes a specified element from this collection. |
int |
size()
Returns the number of elements in this collection. |
IntSortedSet |
subSet(int from,
int to)
Returns the subset of values lower that a specified value and higher than or equal to another specified value. |
IntSortedSet |
tailSet(int from)
Returns the subset of values higher than or equal to a specified value. |
void |
trimToSize()
Minimizes the memory used by this bit set. |
| Methods inherited from class bak.pcj.set.AbstractIntSet |
equals, hashCode |
| Methods inherited from class bak.pcj.AbstractIntCollection |
addAll, containsAll, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface bak.pcj.IntCollection |
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
public IntBitSet(int maximum)
maximum - the maximum value representable by the new bitset.
IllegalArgumentException - if capacity is negative.public IntBitSet()
public IntBitSet(IntCollection c)
c - the collection whose elements to add to the new
bit set.
NullPointerException - if c is null.
IllegalArgumentException - if any of the elements of the specified collection
is negative.public IntBitSet(int[] a)
a - the array whose elements to add to the new
bit set.
NullPointerException - if a is null.
IllegalArgumentException - if any of the elements of the specified array
is negative.| Method Detail |
public void ensureCapacity(int maximum)
maximum - the maximum element that this set should be able
to contain without increasing the capacity.
IllegalArgumentException - if maximum is negative.public boolean add(int value)
IntSortedSet
add in interface IntSortedSetadd in class AbstractIntCollectionIllegalArgumentException - if value is negative.public IntIterator iterator()
IntCollection
iterator in interface IntCollectionpublic void trimToSize()
trimToSize in interface IntCollectiontrimToSize in class AbstractIntCollectionpublic Object clone()
public void clear()
IntCollection
clear in interface IntCollectionclear in class AbstractIntCollectionpublic boolean contains(int value)
IntCollection
contains in interface IntCollectioncontains in class AbstractIntCollectionpublic boolean isEmpty()
IntCollection
isEmpty in interface IntCollectionisEmpty in class AbstractIntCollectionpublic boolean remove(int value)
IntCollection
remove in interface IntCollectionremove in class AbstractIntCollectionpublic int size()
IntCollection
size in interface IntCollectionsize in class AbstractIntCollectionpublic int first()
IntSortedSet
first in interface IntSortedSetpublic int last()
IntSortedSet
last in interface IntSortedSetpublic IntSortedSet headSet(int to)
IntSortedSet
headSet in interface IntSortedSetto - the upper bound of the returned set (not included).public IntSortedSet tailSet(int from)
IntSortedSet
tailSet in interface IntSortedSetfrom - the lower bound of the returned set (included).
public IntSortedSet subSet(int from,
int to)
IntSortedSet
subSet in interface IntSortedSetfrom - the lower bound of the returned set (included).to - the upper bound of the returned set (not included).
|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||