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