Class SearchNode

  • All Implemented Interfaces:
    Direct Known Subclasses:

    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

      Constructor Description
      SearchNode​(SearchState state, SearchNode parent, double cost)
      Create a search node with given state, parent, and cost.
    • Constructor Detail

      • SearchNode

        public SearchNode​(SearchState state,
                          SearchNode parent,
                          double cost)
        Create a search node with given state, parent, and cost.
        state - the state
        parent - the parent
        cost - the cost
    • Method Detail

      • getPriority

        public double getPriority()
        Description copied from interface: QueueElement
        Get this element's priority.
        Specified by:
        getPriority in interface QueueElement
        the priority
      • setPriority

        public void setPriority​(double priority)
        Description copied from interface: QueueElement
        Set the priority of this element.
        Specified by:
        setPriority in interface QueueElement
        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 interface QueueElement
        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 interface QueueElement
        position - the new position for the element
      • getParent

        public SearchNode getParent()
        The node that generated this node.
        the parent
      • getCost

        public double getCost()
        Get the cost for this node.
        the cost
      • getState

        public SearchState getState()
        The state for this search node.
        the state
      • isFinal

        public boolean isFinal()
        Is the node's state final?
        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.
        the iterator
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object