|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--arlut.csd.Util.NamedStack
NamedStack is a data structure that allows named items to be placed on a stack. When it comes time to pop data off the stack, the pop operation takes the name of the item to be popped, and all items pushed on the stack after the named item will also be popped.
That is, NamedStack is basically a Stack that supports rollback to a named state. It is used in the Ganymede server to support checkpoint operations.
NamedStack does not require that names of pushed items be unique. A pop operation will simply pop up to the last item matching the given name off the stack.
| Field Summary | |
private java.util.Stack |
stack
|
| Constructor Summary | |
NamedStack()
|
|
| Method Summary | |
java.lang.Object |
elementAt(int index)
|
boolean |
empty()
|
int |
findName(java.lang.String name)
findName() returns the top-most index at which the name is present in the named object stack, or -1 if the name was not found. |
java.lang.String |
getTopName()
This method returns the name associated with the last item pushed onto this name stack, without altering the stack. |
java.lang.Object |
getTopObject()
This method returns the object associated with the last item pushed onto this name stack, without altering the stack. |
java.lang.String |
nameAt(int index)
|
java.lang.Object |
pop()
This is just plain old pop, it will return the top element without regard to its name. |
java.lang.Object |
pop(java.lang.String name)
pop rolls the state of the stack back to the time just before the top-most named object matching name was pushed. |
java.lang.Object |
push(java.lang.String name,
java.lang.Object item)
push pushes a named item onto the stack. |
void |
removeAllElements()
|
int |
size()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private java.util.Stack stack
| Constructor Detail |
public NamedStack()
| Method Detail |
public java.lang.Object push(java.lang.String name,
java.lang.Object item)
push pushes a named item onto the stack.
public java.lang.Object pop(java.lang.String name)
pop rolls the state of the stack back to the time just before the top-most named object matching name was pushed.
public java.lang.Object pop()
This is just plain old pop, it will return the top element without regard to its name.
public java.lang.Object elementAt(int index)
public java.lang.String nameAt(int index)
public int size()
public void removeAllElements()
public java.lang.String getTopName()
This method returns the name associated with the last item pushed onto this name stack, without altering the stack.
public java.lang.Object getTopObject()
This method returns the object associated with the last item pushed onto this name stack, without altering the stack.
public int findName(java.lang.String name)
findName() returns the top-most index at which the name is present in the named object stack, or -1 if the name was not found.
public boolean empty()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||