net.walend.measured
Class JITShortestCEDistances

java.lang.Object
  |
  +--net.walend.measured.AbstractShortestCEDistances
        |
        +--net.walend.measured.DijkstraShortestCEDistances
              |
              +--net.walend.measured.JITShortestCEDistances
All Implemented Interfaces:
HasState, java.io.Serializable, ShortestCEDistances

public class JITShortestCEDistances
extends DijkstraShortestCEDistances
implements ShortestCEDistances, java.io.Serializable

JITShortestCEDistances is an implementation of ShortestCEDistances that uses Dijkstra's algorithm to find the shortest distances just in time. It caches previous results and uses those results to run future calls for new destinations faster. For repeated destinations, it simply returns an existing result.

Author:
David Walend dfw1@cornell.edu
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class net.walend.measured.DijkstraShortestCEDistances
 
Field Summary
private  boolean[] measuredNodes
           
 
Fields inherited from class net.walend.measured.DijkstraShortestCEDistances
 
Fields inherited from class net.walend.measured.AbstractShortestCEDistances
 
Constructor Summary
JITShortestCEDistances(IndexedCEDigraph ceDigraph, CEPathMeter pathMeter)
           
 
Method Summary
 int getLength(int from, int to)
           
 void recalculate()
          If the digraph is not valid, rediscover the shortest paths.
 
Methods inherited from class net.walend.measured.DijkstraShortestCEDistances
createNode, dijkstra, initWithNodesFrom
 
Methods inherited from class net.walend.measured.AbstractShortestCEDistances
bfTest, getBase, getLength, getPathMeter, getPrincipleInterface, initializeDistances, relax, safeLength, sameStateAs, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.walend.measured.ShortestCEDistances
getBase, getLength, getPathMeter
 
Methods inherited from interface net.walend.collection.HasState
getPrincipleInterface, sameStateAs
 

Field Detail

measuredNodes

private boolean[] measuredNodes
Constructor Detail

JITShortestCEDistances

public JITShortestCEDistances(IndexedCEDigraph ceDigraph,
                              CEPathMeter pathMeter)
                       throws CENegativeWeightCycleException
Method Detail

recalculate

public void recalculate()
                 throws CENegativeWeightCycleException
If the digraph is not valid, rediscover the shortest paths.

Specified by:
recalculate in interface ShortestCEDistances
Specified by:
recalculate in class AbstractShortestCEDistances
CENegativeWeightCycleException

getLength

public int getLength(int from,
                     int to)
Specified by:
getLength in interface ShortestCEDistances
Overrides:
getLength in class AbstractShortestCEDistances


Copyright (c) 2001, 2002, David Walend