|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectstructure.AbstractStructure
structure.AbstractLinear
structure.AbstractStack
structure.StackArray
public class StackArray
An implementation of a stack using an array.
Constructor Summary | |
---|---|
StackArray(int size)
Construct a stack capable of holding at least size elements. |
Method Summary | |
---|---|
void |
add(Object item)
Add a value to the top of the stack. |
void |
clear()
Remove all elements from the stack. |
Object |
get()
Get a reference to the top value in the stack. |
boolean |
isEmpty()
Determine if the stack is empty. |
boolean |
isFull()
Determine if the stack is full. |
Iterator |
iterator()
Returns an iterator for traversing the structure. |
Object |
remove()
Remove a value from the top of the stack. |
int |
size()
Determine the number of elements in the stack. |
String |
toString()
Construct a string representation of the stack. |
Methods inherited from class structure.AbstractStack |
---|
getFirst, peek, pop, push |
Methods inherited from class structure.AbstractLinear |
---|
empty, remove |
Methods inherited from class structure.AbstractStructure |
---|
contains, elements, hashCode, values |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface structure.Stack |
---|
empty, getFirst, peek, pop, push |
Methods inherited from interface structure.Structure |
---|
contains, elements, remove, values |
Constructor Detail |
---|
public StackArray(int size)
size
- The maximum size of the stack.Method Detail |
---|
public void clear()
clear
in interface Structure
public void add(Object item)
add
in interface Linear
add
in interface Stack
add
in interface Structure
item
- The value to be added.AbstractStack.push(java.lang.Object)
public Object remove()
remove
in interface Linear
remove
in interface Stack
AbstractStack.pop()
public Object get()
get
in interface Linear
get
in interface Stack
public Iterator iterator()
Structure
iterator
in interface Structure
AbstractIterator
,
Iterator
,
Enumeration
,
Structure.elements()
public int size()
size
in interface Linear
size
in interface Stack
size
in interface Structure
public boolean isEmpty()
isEmpty
in interface Structure
isEmpty
in class AbstractStructure
AbstractLinear.empty()
public boolean isFull()
public String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |