openlist.examples
Class WeightedDirectedGraph.Node

java.lang.Object
  extended by openlist.examples.WeightedDirectedGraph.Node
Enclosing class:
WeightedDirectedGraph

 class WeightedDirectedGraph.Node
extends java.lang.Object

Node represents a node in the graph, along with distance and predecessor information used by Dijkstra's algorithm.


Field Summary
(package private)  OpenList<java.lang.Object> arcs
          the list of out-going Arcs from this Node
(package private)  long distance
          the distance of this Node from the source node
(package private)  Symbol name
          the symbol giving the name of this Node
(package private)  WeightedDirectedGraph.Node predecessor
          the predecessor of this Node on the shortest path from the source
(package private)  OpenList<java.lang.Object> raw
          the symbolic OpenList specification of the node.
 
Constructor Summary
WeightedDirectedGraph.Node(java.lang.Object _raw)
          Construct a node from a raw OpenList.
 
Method Summary
(package private)  void internalizeNode()
          Once we have all Nodes collected in raw form, internalize() processes s Node's targets, obtaining the reference to the the targets, as opposed to just the names of the targets.
(package private)  void retire()
          retire() retires this Node in the execution of Dijkstra's algorithm.
 java.lang.String toString()
          Return a String representation of the Node, for final output, in the order distance, name, and predecessor name (on the shortest path from the source).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

raw

OpenList<java.lang.Object> raw
the symbolic OpenList specification of the node. This is translated into other components for faster execution of the algorithm.


name

Symbol name
the symbol giving the name of this Node


arcs

OpenList<java.lang.Object> arcs
the list of out-going Arcs from this Node


distance

long distance
the distance of this Node from the source node


predecessor

WeightedDirectedGraph.Node predecessor
the predecessor of this Node on the shortest path from the source

Constructor Detail

WeightedDirectedGraph.Node

WeightedDirectedGraph.Node(java.lang.Object _raw)
Construct a node from a raw OpenList.

Parameters:
_raw - OpenList that is expected to have the form ( ( ) ...) for any number of target Nodes.
Method Detail

retire

void retire()
retire() retires this Node in the execution of Dijkstra's algorithm. It makes the node inactive. It updates the distances of any targets, and if a better distance results, the predecessor of the target is set to be this Nodes, as opposed to what it was.


internalizeNode

void internalizeNode()
Once we have all Nodes collected in raw form, internalize() processes s Node's targets, obtaining the reference to the the targets, as opposed to just the names of the targets. This avoids repeated symbolic lookup during the execution of Dijkstra's algorithm.


toString

public java.lang.String toString()
Return a String representation of the Node, for final output, in the order distance, name, and predecessor name (on the shortest path from the source).

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the Node