|
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.AbstractShortCollection bak.pcj.set.AbstractShortSet bak.pcj.set.ShortBitSet
This class represents bit array based sets of short 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 ShortSortedSet is supported from PCJ 1.2. Prior to 1.2, only ShortSet 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 | |
ShortBitSet()
Creates a new empty bit set with a capacity of 64. |
|
ShortBitSet(short maximum)
Creates a new bit set with a specified maximum value. |
|
ShortBitSet(short[] a)
Creates a new bit set with the same elements as the specified array. |
|
ShortBitSet(ShortCollection c)
Creates a new bit set with the same elements as the specified collection. |
Method Summary | |
boolean |
add(short value)
Adds an element to this set. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this bit set. |
boolean |
contains(short 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. |
short |
first()
Returns the lowest element of this set. |
ShortSortedSet |
headSet(short to)
Returns the subset of values lower than a specified value. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
ShortIterator |
iterator()
Returns an iterator over this collection. |
short |
last()
Returns the highest element of this set. |
boolean |
remove(short value)
Removes a specified element from this collection. |
int |
size()
Returns the number of elements in this collection. |
ShortSortedSet |
subSet(short from,
short to)
Returns the subset of values lower that a specified value and higher than or equal to another specified value. |
ShortSortedSet |
tailSet(short 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.AbstractShortSet |
equals, hashCode |
Methods inherited from class bak.pcj.AbstractShortCollection |
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.ShortCollection |
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
Constructor Detail |
public ShortBitSet(short maximum)
maximum
- the maximum value representable by the new bitset.
IllegalArgumentException
- if capacity is negative.public ShortBitSet()
public ShortBitSet(ShortCollection 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 ShortBitSet(short[] 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(short value)
ShortSortedSet
add
in interface ShortSortedSet
add
in class AbstractShortCollection
IllegalArgumentException
- if value is negative.public ShortIterator iterator()
ShortCollection
iterator
in interface ShortCollection
public void trimToSize()
trimToSize
in interface ShortCollection
trimToSize
in class AbstractShortCollection
public Object clone()
public void clear()
ShortCollection
clear
in interface ShortCollection
clear
in class AbstractShortCollection
public boolean contains(short value)
ShortCollection
contains
in interface ShortCollection
contains
in class AbstractShortCollection
public boolean isEmpty()
ShortCollection
isEmpty
in interface ShortCollection
isEmpty
in class AbstractShortCollection
public boolean remove(short value)
ShortCollection
remove
in interface ShortCollection
remove
in class AbstractShortCollection
public int size()
ShortCollection
size
in interface ShortCollection
size
in class AbstractShortCollection
public short first()
ShortSortedSet
first
in interface ShortSortedSet
public short last()
ShortSortedSet
last
in interface ShortSortedSet
public ShortSortedSet headSet(short to)
ShortSortedSet
headSet
in interface ShortSortedSet
to
- the upper bound of the returned set (not included).public ShortSortedSet tailSet(short from)
ShortSortedSet
tailSet
in interface ShortSortedSet
from
- the lower bound of the returned set (included).public ShortSortedSet subSet(short from, short to)
ShortSortedSet
subSet
in interface ShortSortedSet
from
- 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 |