movement.map
Class DijkstraPathFinder

java.lang.Object
  extended by movement.map.DijkstraPathFinder

public class DijkstraPathFinder
extends java.lang.Object

Implementation of the Dijkstra's shortest path algorithm.


Constructor Summary
DijkstraPathFinder(int[] okMapNodes)
          Constructor.
 
Method Summary
 java.util.List<MapNode> getShortestPath(MapNode from, MapNode to)
          Finds and returns a shortest path between two map nodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DijkstraPathFinder

public DijkstraPathFinder(int[] okMapNodes)
Constructor.

Parameters:
okMapNodes - The map node types that are OK for paths or null if all nodes are OK
Method Detail

getShortestPath

public java.util.List<MapNode> getShortestPath(MapNode from,
                                               MapNode to)
Finds and returns a shortest path between two map nodes

Parameters:
from - The source of the path
to - The destination of the path
Returns:
a shortest path between the source and destination nodes in a list of MapNodes or an empty list if such path is not available