Package 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 Description class
SearchNode.NextNodeIterator
This iterator generates search nodes that refer to the states reachable from the state pertaining to a this search node.
-
Constructor Summary
Constructors Constructor 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 Description double
getCost()
Get the cost for this node.SearchNode.NextNodeIterator
getNextNodes()
Get an iterator over the new search nodes reachable from this node by state transitions.SearchNode
getParent()
The node that generated this node.int
getPosition()
Get the queue position of this element.double
getPriority()
Get this element's priority.SearchState
getState()
The state for this search node.boolean
isFinal()
Is the node's state final?void
setPosition(int position)
Set the current queue position for this element.void
setPriority(double priority)
Set the priority of this element.java.lang.String
toString()
-
-
-
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:QueueElement
Get this element's priority.- Specified by:
getPriority
in interfaceQueueElement
- Returns:
- the priority
-
setPriority
public void setPriority(double priority)
Description copied from interface:QueueElement
Set the priority of this element.- Specified by:
setPriority
in interfaceQueueElement
- Parameters:
priority
- the element's new priority
-
getPosition
public int getPosition()
Description copied from interface:QueueElement
Get the queue position of this element. If the element is not in a queue, the returned value is meaningless.- Specified by:
getPosition
in interfaceQueueElement
- Returns:
- the current position
-
setPosition
public void setPosition(int position)
Description copied from interface:QueueElement
Set the current queue position for this element. This should only be called by a queue implementation.- Specified by:
setPosition
in 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:
toString
in classjava.lang.Object
-
-