| bak.pcj.list.AbstractByteList bak.pcj.list.ByteArrayList bak.pcj.list.ByteArrayStack
ByteArrayStack | public class ByteArrayStack extends ByteArrayList implements ByteStack(Code) | | This class represents an array implemenation of stacks of
byte values.
See Also: java.util.ArrayList author: Søren Bak version: 1.1 2003/3/3 since: 1.0 |
Constructor Summary | |
public | ByteArrayStack() Creates a new array stack with capacity 10 and a relative
growth factor of 1.0. | public | ByteArrayStack(ByteCollection c) Creates a new array stack with the same elements as a
specified collection. | public | ByteArrayStack(byte[] a) Creates a new array stack with the same elements as a
specified array. | public | ByteArrayStack(int capacity) Creates a new array stack with a specified capacity and a
relative growth factor of 1.0. | public | ByteArrayStack(int capacity, double growthFactor) Creates a new array stack with a specified capacity and
relative growth factor. | public | ByteArrayStack(int capacity, int growthChunk) Creates a new array stack with a specified capacity and
absolute growth factor.
The array capacity increases to capacity()+growthChunk.
This strategy is good for avoiding wasting memory. |
Method Summary | |
public byte | peek() | public byte | pop() | public void | push(byte v) |
ByteArrayStack | public ByteArrayStack(ByteCollection c)(Code) | | Creates a new array stack with the same elements as a
specified collection. The elements of the specified collection
are pushed in the collection's iteration order.
Parameters: c - the collection whose elements to add to the newstack. throws: NullPointerException - if c is null. |
ByteArrayStack | public ByteArrayStack(byte[] a)(Code) | | Creates a new array stack with the same elements as a
specified array. The elements of the specified array
are pushed in the order of the array.
Parameters: a - the array whose elements to add to the newstack. throws: NullPointerException - if a is null. since: 1.1 |
ByteArrayStack | public ByteArrayStack(int capacity, double growthFactor)(Code) | | Creates a new array stack with a specified capacity and
relative growth factor.
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.
Parameters: capacity - the initial capacity of the stack. Parameters: growthFactor - the relative amount with which to increase thethe capacity when a capacity increase is needed. throws: IllegalArgumentException - if capacity is negative;if growthFactor is negative. |
ByteArrayStack | public ByteArrayStack(int capacity, int growthChunk)(Code) | | Creates a new array stack with a specified capacity and
absolute growth factor.
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.
Parameters: capacity - the initial capacity of the stack. Parameters: growthChunk - the absolute amount with which to increase thethe capacity when a capacity increase is needed. throws: IllegalArgumentException - if capacity is negative;if growthChunk is negative. |
push | public void push(byte v)(Code) | | |
|
|