org.samcrow
Class RouteFinder

java.lang.Object
  extended by org.samcrow.RouteFinder

public class RouteFinder
extends java.lang.Object

Finds routes
Based in part on http://renaud.waldura.com/doc/java/dijkstra/

Author:
Sam Crow

Constructor Summary
RouteFinder()
           
 
Method Summary
private  Node closestNode(java.util.Collection<Node> nodes, java.util.HashMap<Node,java.lang.Double> distances)
           
 Route fastestRouteDijkstra(java.util.Collection<Node> nodes, Destination start, Destination end)
           
private  Link linkBetween(Node thisNode, Node remoteNode)
           
private  java.util.Collection<Node> neighbors(Node thisNode, java.util.Collection<Node> q)
          Get the neigbors of this node.
private  double timeBetween(Node thisNode, Node remoteNode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouteFinder

public RouteFinder()
Method Detail

fastestRouteDijkstra

public Route fastestRouteDijkstra(java.util.Collection<Node> nodes,
                                  Destination start,
                                  Destination end)

closestNode

private Node closestNode(java.util.Collection<Node> nodes,
                         java.util.HashMap<Node,java.lang.Double> distances)

linkBetween

private Link linkBetween(Node thisNode,
                         Node remoteNode)

timeBetween

private double timeBetween(Node thisNode,
                           Node remoteNode)

neighbors

private java.util.Collection<Node> neighbors(Node thisNode,
                                             java.util.Collection<Node> q)
Get the neigbors of this node. This means getting the nodes that are directly linked to this one

Parameters:
thisNode - the node to find neighbors of
q - the Collection of active nodes. Only Nodes in this Collection will be considered.
Returns:
A Collection of nodes