|
Algorithm Development Kit 1.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectalgs.model.searchtree.states.StateStack
public class StateStack
Provide storage that behaves like a stack.
INodeSet.insert(INode) and INodeSet.remove() are
constant time operations. However, INodeSet.contains(INode)
becomes O(n) since the entire stack must be inspected. Finally,
INodeSet.remove(INode) is O(n) since whole stack must be searched.
| Constructor Summary | |
|---|---|
StateStack()
|
|
| Method Summary | |
|---|---|
INode |
contains(INode n)
A costly operation in a stack; typically not required. |
void |
insert(INode n)
Insert pushes the element onto the stack. |
boolean |
isEmpty()
Is stack empty? |
java.util.Iterator<INode> |
iterator()
Expose iterator to internal board states. |
INode |
remove()
Remove takes the topmost element from the stack. |
boolean |
remove(INode n)
Remove actual value from the list. |
int |
size()
Determine number of states in the set. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StateStack()
| Method Detail |
|---|
public void insert(INode n)
insert in interface INodeSetn - the INode to store in the set.public INode remove()
remove in interface INodeSetpublic boolean isEmpty()
isEmpty in interface INodeSetpublic int size()
size in interface INodeSetpublic java.util.Iterator<INode> iterator()
iterator in interface INodeSetpublic INode contains(INode n)
contains in interface INodeSetn - the target node to be looked for.public boolean remove(INode n)
remove in interface INodeSetn - the node representing the value to be removed from the set.INodeSet.remove(INode)
|
Algorithm Development Kit 1.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||