org.samcrow
Class RouteFinder
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RouteFinder
public RouteFinder()
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 ofq
- the Collection of active nodes. Only Nodes in this Collection will be considered.
- Returns:
- A Collection of nodes