|
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.StateQueue
public class StateQueue
Provide storage that behaves like a queue.
INodeSet.insert(INode) and INodeSet.remove() are
constant time operations. However, INodeSet.contains(INode)
becomes O(n) since the entire queue must be inspected. Finally,
INodeSet.remove(INode) is O(n) since whole queue must be searched.
| Constructor Summary | |
|---|---|
StateQueue()
|
|
| Method Summary | |
|---|---|
INode |
contains(INode n)
Return the actual node in storage that is equal to the given node. |
void |
insert(INode n)
Insert node places at end of queue. |
boolean |
isEmpty()
Is collection empty. |
java.util.Iterator<INode> |
iterator()
Return iterator to the existing board states. |
INode |
remove()
Remove a node by taking the first one from the queue. |
boolean |
remove(INode n)
Remove actual value from the set. |
int |
size()
Return the 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 StateQueue()
| Method Detail |
|---|
public boolean isEmpty()
INodeSet
isEmpty in interface INodeSetpublic int size()
INodeSet
size in interface INodeSetpublic java.util.Iterator<INode> iterator()
INodeSet
iterator in interface INodeSetpublic void insert(INode n)
insert in interface INodeSetn - INode to be inserted into the set.public INode remove()
remove in interface INodeSetpublic INode contains(INode n)
INodeSetThe signature of this method may look odd. Recall that If the node doesn't exist then return null.
contains in interface INodeSetn - Board state to be inspectedpublic boolean remove(INode n)
An existing INode in the set that .equals(n) is selected for removal.
remove in interface INodeSetn - the node representing the value to be removed from the list.INodeSet.remove(INode)
|
Algorithm Development Kit 1.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||