|
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.AbstractBooleanCollection
bak.pcj.list.AbstractBooleanList
bak.pcj.list.BooleanArrayList
bak.pcj.list.BooleanArrayStack
This class represents an array implemenation of stacks of boolean values.
ArrayList,
Serialized Form| Field Summary |
| Fields inherited from class bak.pcj.list.BooleanArrayList |
DEFAULT_CAPACITY, DEFAULT_GROWTH_CHUNK, DEFAULT_GROWTH_FACTOR |
| Constructor Summary | |
BooleanArrayStack()
Creates a new array stack with capacity 10 and a relative growth factor of 1.0. |
|
BooleanArrayStack(boolean[] a)
Creates a new array stack with the same elements as a specified array. |
|
BooleanArrayStack(BooleanCollection c)
Creates a new array stack with the same elements as a specified collection. |
|
BooleanArrayStack(int capacity)
Creates a new array stack with a specified capacity and a relative growth factor of 1.0. |
|
BooleanArrayStack(int capacity,
double growthFactor)
Creates a new array stack with a specified capacity and relative growth factor. |
|
BooleanArrayStack(int capacity,
int growthChunk)
Creates a new array stack with a specified capacity and absolute growth factor. |
|
| Method Summary | |
boolean |
peek()
Returns the top element of this stack. |
boolean |
pop()
Pops an element off this stack. |
void |
push(boolean v)
Pushes a specified element onto this stack. |
| Methods inherited from class bak.pcj.list.BooleanArrayList |
add, capacity, clear, clone, contains, ensureCapacity, equals, get, hashCode, indexOf, indexOf, isEmpty, lastIndexOf, remove, removeElementAt, set, size, toArray, toArray, trimToSize |
| Methods inherited from class bak.pcj.list.AbstractBooleanList |
add, addAll, iterator, lastIndexOf, listIterator, listIterator |
| Methods inherited from class bak.pcj.AbstractBooleanCollection |
addAll, containsAll, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface bak.pcj.list.BooleanList |
add, addAll, get, indexOf, indexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, removeElementAt, set |
| Methods inherited from interface bak.pcj.BooleanCollection |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, trimToSize |
| Constructor Detail |
public BooleanArrayStack()
BooleanArrayStack(int,double)public BooleanArrayStack(BooleanCollection c)
c - the collection whose elements to add to the new
stack.
NullPointerException - if c is null.public BooleanArrayStack(boolean[] a)
a - the array whose elements to add to the new
stack.
NullPointerException - if a is null.public BooleanArrayStack(int capacity)
capacity - the initial capacity of the stack.
IllegalArgumentException - if capacity is negative.BooleanArrayStack(int,double)
public BooleanArrayStack(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 stack.
capacity - the initial capacity of the stack.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 BooleanArrayStack(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 stack.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 void push(boolean v)
BooleanStack
push in interface BooleanStackv - the element to push onto this stack.public boolean pop()
BooleanStack
pop in interface BooleanStackBooleanStack.peek()public boolean peek()
BooleanStack
peek in interface BooleanStackBooleanStack.pop()
|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||