|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.AbstractListModel | +--javax.swing.DefaultListModel | +--kiwi.ui.model.DefaultStackModel
This class is a default implementation of the StackModel
interface. It inherits its base functionality from
DefaultListModel
, and adds only methods for dealing with
stack operations.
Fields inherited from class javax.swing.AbstractListModel |
listenerList |
Constructor Summary | |
DefaultStackModel()
|
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 class javax.swing.DefaultListModel |
add,
addElement,
capacity,
clear,
contains,
copyInto,
elementAt,
elements,
ensureCapacity,
firstElement,
get,
getElementAt,
getSize,
indexOf,
indexOf,
insertElementAt,
lastElement,
lastIndexOf,
lastIndexOf,
remove,
removeAllElements,
removeElement,
removeElementAt,
removeRange,
set,
setElementAt,
setSize,
size,
toArray,
toString,
trimToSize |
Methods inherited from class javax.swing.AbstractListModel |
addListDataListener,
fireContentsChanged,
fireIntervalAdded,
fireIntervalRemoved,
removeListDataListener |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public DefaultStackModel()
Method Detail |
public void push(Object obj)
obj
- The object to push.public Object pop() throws EmptyStackException
public void drop() throws EmptyStackException
public Object peek() throws EmptyStackException
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 |