|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.jsl.AbstractOpenClosedListSearch
Abstract base class for a search that works using open and closed list for nodes already searched and nodes still to be processed.
Field Summary | |
protected Collection |
closedList
|
protected boolean |
closeGoal
|
protected int |
expandCnt
|
protected boolean |
expandGoal
|
protected int |
maxClosed
|
protected int |
maxDepth
|
protected int |
maxExpands
|
protected int |
maxOpen
|
protected List |
openList
|
protected SearchNode |
seed
|
protected boolean |
useHashSet
|
Constructor Summary | |
AbstractOpenClosedListSearch()
|
Method Summary | |
protected void |
checkForEmergencyStop()
|
protected boolean |
cutOff(SearchNode searchNode)
|
protected void |
expand(SearchNode searchNode)
|
Collection |
getClosedList()
Returns the unordered list of nodes already searched. |
boolean |
getCloseGoal()
|
boolean |
getExpandGoal()
Returns whether nodes that have been identified as goals shall be expanded and its successor be added to the open list. |
int |
getMaxClosed()
|
int |
getMaxDepth()
|
int |
getMaxExpands()
|
int |
getMaxOpen()
|
List |
getOpenList()
Returns the list of open nodes yet to be searched in order in which they are scheduled for processing. |
SearchNode |
search()
Searches for the search node that is marked as a goal and returns it. |
Collection |
search(int maxGoals)
Searches for search nodes marked as a goal and returns them. |
void |
setCloseGoal(boolean closeGoal)
|
void |
setExpandGoal(boolean expandGoal)
Sets whether nodes that have been identified as goals shall be expanded and its successor be added to the open list. |
void |
setMaxClosed(int maxClosed)
|
void |
setMaxDepth(int maxDepth)
|
void |
setMaxExpands(int maxExpands)
|
void |
setMaxOpen(int maxOpen)
|
void |
setSeed(SearchNode seed)
Sets the seed of the search, i.e. the root node of the search. |
void |
setUseHashSet(boolean useHashSet)
Determines whether nodes in the closed list shall be stored using a HashSet .
|
protected abstract void |
writeState(SearchNode state)
|
protected abstract void |
writeStates(Collection states)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected SearchNode seed
protected int maxDepth
protected int maxExpands
protected int maxClosed
protected int maxOpen
protected int expandCnt
protected List openList
protected Collection closedList
protected boolean expandGoal
protected boolean closeGoal
protected boolean useHashSet
Constructor Detail |
public AbstractOpenClosedListSearch()
Method Detail |
public void setSeed(SearchNode seed)
Search
setSeed
in interface Search
seed
- the root node of the searchpublic Collection search(int maxGoals) throws SearchException
Search
search
in interface Search
maxGoals
- the maximum number of goals to search for.
SearchException
- signals an abnormal termination of the searchpublic SearchNode search() throws SearchException
Search
search
in interface Search
null
if none was found
SearchException
- signals an abnormal termination of the searchpublic Collection getClosedList()
public List getOpenList()
public void setUseHashSet(boolean useHashSet)
HashSet
.
If this feature is turned on (default) Object.hashCode()
must be implemented
properly in the custom SearchNode
implementation.
useHashSet
- true
if a HashSet
shall be used to store the closed list, false
to use an ArrayList
public boolean getExpandGoal()
true
if goals will be expanded, false
otherwisepublic void setExpandGoal(boolean expandGoal)
expandGoal
- true
if goals will be expanded, false
otherwisepublic int getMaxDepth()
public void setMaxDepth(int maxDepth)
public int getMaxClosed()
public int getMaxExpands()
public int getMaxOpen()
public void setMaxClosed(int maxClosed)
public void setMaxExpands(int maxExpands)
public void setMaxOpen(int maxOpen)
public boolean getCloseGoal()
public void setCloseGoal(boolean closeGoal)
protected void expand(SearchNode searchNode) throws SearchException
SearchException
protected abstract void writeState(SearchNode state)
protected abstract void writeStates(Collection states)
protected void checkForEmergencyStop() throws SearchException
SearchException
protected boolean cutOff(SearchNode searchNode)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |