|
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.AbstractBooleanCollection bak.pcj.list.AbstractBooleanList bak.pcj.list.BooleanArrayDeque
This class represents an array implementaion of deques of boolean values.
LinkedList
,
Serialized FormField Summary | |
static int |
DEFAULT_CAPACITY
The default capacity of this deque. |
static int |
DEFAULT_GROWTH_CHUNK
The default chunk size with which to increase the capacity of this deque. |
static double |
DEFAULT_GROWTH_FACTOR
The default factor with which to increase the capacity of this deque. |
Constructor Summary | |
BooleanArrayDeque()
Creates a new array deque with capacity 10 and a relative growth factor of 1.0. |
|
BooleanArrayDeque(boolean[] a)
Creates a new array deque with the same elements as a specified array. |
|
BooleanArrayDeque(BooleanCollection c)
Creates a new array deque with the same elements as a specified collection. |
|
BooleanArrayDeque(int capacity)
Creates a new array deque with a specified capacity and a relative growth factor of 1.0. |
|
BooleanArrayDeque(int capacity,
double growthFactor)
Creates a new array deque with a specified capacity and relative growth factor. |
|
BooleanArrayDeque(int capacity,
int growthChunk)
Creates a new array deque with a specified capacity and absolute growth factor. |
Method Summary | |
void |
add(int index,
boolean v)
Adds an element to this list at a specified index. |
void |
addFirst(boolean v)
Adds an element to the beginning of this deque. |
void |
addLast(boolean v)
Adds an element to the end of this deque. |
int |
capacity()
Returns the current capacity of this deque. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this array deque. |
boolean |
contains(boolean v)
Indicates whether this collection contains a specified element. |
int |
ensureCapacity(int capacity)
Ensures that this deque has at least a specified capacity. |
boolean |
equals(Object obj)
Indicates whether this collection is equal to some object. |
boolean |
get(int index)
Returns the element at a specified position in this list. |
boolean |
getFirst()
Returns the first element of this deque. |
boolean |
getLast()
Returns the last element of this deque. |
int |
hashCode()
Returns a hash code value for this collection. |
int |
indexOf(boolean c)
Returns the index of the first occurance of a specified element in this list. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
int |
lastIndexOf(boolean c)
Returns the index of the last occurance of a specified element in this list. |
boolean |
remove(boolean v)
Removes a specified element from this collection. |
boolean |
removeElementAt(int index)
Removes the element at a specified index in this list. |
boolean |
removeFirst()
Removes the first element of this deque. |
boolean |
removeLast()
Removes the last element of this deque. |
boolean |
set(int index,
boolean v)
Sets a specified element to a new value. |
int |
size()
Returns the number of elements in this collection. |
boolean[] |
toArray(boolean[] a)
Returns the elements of this collection as an array. |
void |
trimToSize()
Minimizes the memory used by this array deque. |
Methods inherited from class bak.pcj.list.AbstractBooleanList |
add, addAll, indexOf, iterator, lastIndexOf, listIterator, listIterator |
Methods inherited from class bak.pcj.AbstractBooleanCollection |
addAll, containsAll, removeAll, retainAll, toArray, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface bak.pcj.list.BooleanList |
addAll, indexOf, lastIndexOf, listIterator, listIterator |
Methods inherited from interface bak.pcj.BooleanCollection |
add, addAll, containsAll, iterator, removeAll, retainAll, toArray |
Field Detail |
public static final double DEFAULT_GROWTH_FACTOR
public static final int DEFAULT_GROWTH_CHUNK
public static final int DEFAULT_CAPACITY
Constructor Detail |
public BooleanArrayDeque()
BooleanArrayDeque(int,double)
public BooleanArrayDeque(BooleanCollection c)
c
- the collection whose elements to add to the new
deque.
NullPointerException
- if c is null.public BooleanArrayDeque(boolean[] a)
a
- the array whose elements to add to the new
deque.
NullPointerException
- if a is null.public BooleanArrayDeque(int capacity)
capacity
- the initial capacity of the deque.
IllegalArgumentException
- if capacity is negative.BooleanArrayDeque(int,double)
public BooleanArrayDeque(int capacity, double growthFactor)
The array capacity increases to capacity()*(1+growthFactor). This strategy is good for avoiding many capacity increases, but the amount of wasted memory is approximately the size of the deque.
capacity
- the initial capacity of the deque.growthFactor
- the relative amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException
- if capacity is negative;
if growthFactor is negative.public BooleanArrayDeque(int capacity, int growthChunk)
The array capacity increases to capacity()+growthChunk. This strategy is good for avoiding wasting memory. However, an overhead is potentially introduced by frequent capacity increases.
capacity
- the initial capacity of the deque.growthChunk
- the absolute amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException
- if capacity is negative;
if growthChunk is negative.Method Detail |
public int ensureCapacity(int capacity)
capacity
- the minimum capacity of this deque.
capacity()
public int capacity()
ensureCapacity(int)
public void add(int index, boolean v)
BooleanList
add
in interface BooleanList
add
in class AbstractBooleanList
public boolean get(int index)
BooleanList
get
in interface BooleanList
index
- the position of the element to return.
public boolean set(int index, boolean v)
BooleanList
set
in interface BooleanList
index
- the index of the element whose value to set.v
- the new value of the specified element.
public boolean removeElementAt(int index)
BooleanList
removeElementAt
in interface BooleanList
removeElementAt
in class AbstractBooleanList
public void trimToSize()
trimToSize
in interface BooleanCollection
trimToSize
in class AbstractBooleanCollection
public Object clone()
public boolean getFirst()
BooleanDeque
getFirst
in interface BooleanDeque
public boolean getLast()
BooleanDeque
getLast
in interface BooleanDeque
public void addFirst(boolean v)
BooleanDeque
addFirst
in interface BooleanDeque
v
- the element to add to this deque.public void addLast(boolean v)
BooleanDeque
addLast
in interface BooleanDeque
v
- the element to add to this deque.public boolean removeFirst()
BooleanDeque
removeFirst
in interface BooleanDeque
public boolean removeLast()
BooleanDeque
removeLast
in interface BooleanDeque
public int size()
BooleanCollection
size
in interface BooleanCollection
size
in class AbstractBooleanCollection
public boolean isEmpty()
BooleanCollection
isEmpty
in interface BooleanCollection
isEmpty
in class AbstractBooleanCollection
public void clear()
BooleanCollection
clear
in interface BooleanCollection
clear
in class AbstractBooleanCollection
public boolean contains(boolean v)
BooleanCollection
contains
in interface BooleanCollection
contains
in class AbstractBooleanCollection
public int indexOf(boolean c)
BooleanList
indexOf
in interface BooleanList
indexOf
in class AbstractBooleanList
public int lastIndexOf(boolean c)
BooleanList
lastIndexOf
in interface BooleanList
lastIndexOf
in class AbstractBooleanList
public boolean remove(boolean v)
BooleanCollection
remove
in interface BooleanCollection
remove
in class AbstractBooleanCollection
public boolean[] toArray(boolean[] a)
BooleanCollection
toArray
in interface BooleanCollection
toArray
in class AbstractBooleanCollection
public boolean equals(Object obj)
BooleanCollection
equals
in interface BooleanCollection
equals
in class AbstractBooleanList
public int hashCode()
BooleanCollection
hashCode
in interface BooleanCollection
hashCode
in class AbstractBooleanList
|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |