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