|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.algorithm.template.GeneralSearch.OptionIterator
public abstract static class GeneralSearch.OptionIterator
Abstract implementation base class for iterators determining the traversal order.
Concrete implementations define the traversal order for the state space by providing
an iterator over the state options of a search graph (as induced by a state-model
).
Although it is not required that option iterators extend this class, it usually comes as a great relief since sub classes will not have to deal with too much details. Full-blown option iterators only have to implement the abstract methods of this class and determine the data collection implementation maintained.
Particularly, this iterator approach has the advantage of promising that an option node will not be required again, when the next element has already been requested. Those search algorithms that have a need to keep intermediate states for later comparison, will need to remember the states themselves.
GeneralSearch.createTraversal(GeneralSearchProblem)
,
Serialized FormConstructor Summary | |
---|---|
protected |
GeneralSearch.OptionIterator(GeneralSearchProblem problem)
Create a traversal iterator over the problem's state options. |
Method Summary | |
---|---|
protected abstract boolean |
add(java.util.Iterator newNodes)
Concatenate the new nodes and the old nodes. |
protected GeneralSearchProblem |
getProblem()
Get the current problem. |
boolean |
hasNext()
|
protected abstract boolean |
isEmpty()
Returns true if this iterator's collection of nodes currently does not contain any elements. |
java.lang.Object |
next()
|
void |
remove()
Removes from the list of exandable nodes the last element returned by the iterator. |
protected abstract java.lang.Object |
select()
Selects an option to visit from nodes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected GeneralSearch.OptionIterator(GeneralSearchProblem problem)
Sub classes must add the initial state
to their internal collection of nodes, such that it will be the (single) element
expanded first.
problem
- the problem whose options to iterate in an iterator specific order.Method Detail |
---|
protected final GeneralSearchProblem getProblem()
protected abstract boolean isEmpty()
true
if this iterator's collection of nodes currently does not contain any elements.
true
if this collection contains no elements.protected abstract java.lang.Object select()
protected abstract boolean add(java.util.Iterator newNodes)
newNodes
- the new nodes we apparently became aware of. (Might be modified by this method).
public boolean hasNext()
hasNext
in interface java.util.Iterator
public java.lang.Object next()
Will expand the last element returned, and select a state option to visit.
next
in interface java.util.Iterator
public void remove()
When calling this method, the last node that was returned by this iterator will be pruned and not expanded any further.
remove
in interface java.util.Iterator
java.lang.UnsupportedOperationException
- if the remove
operation is not supported by this Iterator.
java.lang.IllegalStateException
- if the next
method has not yet been called, or the remove
method has already been called after the last call to the next
method.
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |