|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.inxar.syntacs.util.ArrayIntStack
Concrete implementation of IntStack
which uses an
array internally.
Constructor Summary | |
ArrayIntStack()
Constructs the ArrayIntStack using a default
capacity. |
|
ArrayIntStack(int capacity)
Constructs the ArrayIntStack with the given
initial capacity. |
Method Summary | |
boolean |
contains(int value)
Returns true if the stack contains the given
value, false otherwise. |
boolean |
isEmpty()
Returns true if the stack has no elements,
false otherwise. |
int |
peek()
Returns the top element of the stack. |
int |
peel(int len)
Pops len elements off the stack and returns the
top item on the stack (a peek() ). |
int |
pop()
Pops the top element off the stack. |
void |
push(int i)
Pushes the given element to the top of the stack. |
int |
size()
Returns the depth of the stack. |
IntArray |
toIntArray()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ArrayIntStack(int capacity)
ArrayIntStack
with the given
initial capacity.public ArrayIntStack()
ArrayIntStack
using a default
capacity.Method Detail |
public void push(int i)
IntStack
push
in interface IntStack
public int pop()
IntStack
pop
in interface IntStack
public int peel(int len)
IntStack
len
elements off the stack and returns the
top item on the stack (a peek()
).peel
in interface IntStack
public int peek()
IntStack
peek
in interface IntStack
public boolean isEmpty()
IntStack
true
if the stack has no elements,
false
otherwise.isEmpty
in interface IntStack
public boolean contains(int value)
IntStack
true
if the stack contains the given
value, false
otherwise.contains
in interface IntStack
public int size()
IntStack
size
in interface IntStack
public IntArray toIntArray()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |