cc.mallet.util.search
Class SearchNode
- java.lang.Object
-
- cc.mallet.util.search.SearchNode
-
- All Implemented Interfaces:
- QueueElement
- Direct Known Subclasses:
- AStarNode
public class SearchNode extends java.lang.Object implements QueueElement
Created by IntelliJ IDEA. User: pereira Date: Jun 20, 2005 Time: 4:46:56 PM Search tree node. A search tree node pertains to some search graph state. Multiple nodes may refer to the same state, representing different ways of reaching the state. Search nodes have a priority, which determines when they will be expanded, and cost of reaching the node from the start of the search.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description classSearchNode.NextNodeIteratorThis iterator generates search nodes that refer to the states reachable from the state pertaining to a this search node.
-
Constructor Summary
Constructors Constructor and Description SearchNode(SearchState state, SearchNode parent, double cost)Create a search node with given state, parent, and cost.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetCost()Get the cost for this node.SearchNode.NextNodeIteratorgetNextNodes()Get an iterator over the new search nodes reachable from this node by state transitions.SearchNodegetParent()The node that generated this node.intgetPosition()Get the queue position of this element.doublegetPriority()Get this element's priority.SearchStategetState()The state for this search node.booleanisFinal()Is the node's state final?voidsetPosition(int position)Set the current queue position for this element.voidsetPriority(double priority)Set the priority of this element.java.lang.StringtoString()
-
-
-
Constructor Detail
-
SearchNode
public SearchNode(SearchState state, SearchNode parent, double cost)
Create a search node with given state, parent, and cost.- Parameters:
state- the stateparent- the parentcost- the cost
-
-
Method Detail
-
getPriority
public double getPriority()
Description copied from interface:QueueElementGet this element's priority.- Specified by:
getPriorityin interfaceQueueElement- Returns:
- the priority
-
setPriority
public void setPriority(double priority)
Description copied from interface:QueueElementSet the priority of this element.- Specified by:
setPriorityin interfaceQueueElement- Parameters:
priority- the element's new priority
-
getPosition
public int getPosition()
Description copied from interface:QueueElementGet the queue position of this element. If the element is not in a queue, the returned value is meaningless.- Specified by:
getPositionin interfaceQueueElement- Returns:
- the current position
-
setPosition
public void setPosition(int position)
Description copied from interface:QueueElementSet the current queue position for this element. This should only be called by a queue implementation.- Specified by:
setPositionin interfaceQueueElement- Parameters:
position- the new position for the element
-
getParent
public SearchNode getParent()
The node that generated this node.- Returns:
- the parent
-
getCost
public double getCost()
Get the cost for this node.- Returns:
- the cost
-
getState
public SearchState getState()
The state for this search node.- Returns:
- the state
-
isFinal
public boolean isFinal()
Is the node's state final?- Returns:
- whether this state's node is final
-
getNextNodes
public SearchNode.NextNodeIterator getNextNodes()
Get an iterator over the new search nodes reachable from this node by state transitions.- Returns:
- the iterator
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG