|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface describing the data model for a stack. This interface extends
ListModel
as a stack is essentially a list with special
semantics.
StackView
Method Summary | |
void |
addStackDataListener(ListDataListener listener)
Add a ListDataListener to this model's list of listeners. |
void |
append(Object obj)
Append an object to the bottom of the stack. |
void |
drop()
Drop an item off the stack. |
int |
getDepth()
Get the depth of the stack. |
boolean |
isEmpty()
Determine if the stack is empty. |
Object |
peek()
Retrieve the topmost item from the stack (without removing the item from the stack). |
Object |
pick(int index)
Remove an object from the stack. |
Object |
pop()
Pop an object off the stack. |
void |
push(Object obj)
Push an object on the stack. |
void |
removeStackDataListener(ListDataListener listener)
Remove a ListDataListener from this model's list of
listeners. |
void |
swap()
Swap the topmost items on the stack. |
Methods inherited from interface javax.swing.ListModel |
addListDataListener,
getElementAt,
getSize,
removeListDataListener |
Method Detail |
public void push(Object obj)
obj
- The object to push.public Object pop() throws EmptyStackException
public void drop()
public Object peek() throws ArrayIndexOutOfBoundsException
public int getDepth()
public void swap() throws EmptyStackException
public boolean isEmpty()
public Object pick(int index) throws ArrayIndexOutOfBoundsException, EmptyStackException
index
- The offset (from the top of the stack) of the item to remove.index
is out of range.public void append(Object obj)
obj
- The object to append.public void addStackDataListener(ListDataListener listener)
ListDataListener
to this model's list of listeners.
Since a stack is essentially a list with some special semantics,
ListDataListeners
are used.listener
- The listener to add.public void removeStackDataListener(ListDataListener listener)
ListDataListener
from this model's list of
listeners. Since a stack is essentially a list with some special
semantics, ListDataListeners
are used.listener
- The listener to add.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |