net.walend.measured
Class JITShortestGEDistances

java.lang.Object
  |
  +--net.walend.measured.AbstractShortestGEDistances
        |
        +--net.walend.measured.DijkstraShortestGEDistances
              |
              +--net.walend.measured.JITShortestGEDistances
All Implemented Interfaces:
HasState, java.io.Serializable, ShortestGEDistances

public class JITShortestGEDistances
extends DijkstraShortestGEDistances
implements ShortestGEDistances, java.io.Serializable

JITShortestGEDistances is an implementation of ShortestGEDistances 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.DijkstraShortestGEDistances
 
Field Summary
private  boolean[] measuredNodes
           
 
Fields inherited from class net.walend.measured.DijkstraShortestGEDistances
 
Fields inherited from class net.walend.measured.AbstractShortestGEDistances
 
Constructor Summary
JITShortestGEDistances(IndexedGEDigraph ceDigraph, GEPathMeter 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.DijkstraShortestGEDistances
createNode, dijkstra, initWithNodesFrom
 
Methods inherited from class net.walend.measured.AbstractShortestGEDistances
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.ShortestGEDistances
getBase, getLength, getPathMeter
 
Methods inherited from interface net.walend.collection.HasState
getPrincipleInterface, sameStateAs
 

Field Detail

measuredNodes

private boolean[] measuredNodes
Constructor Detail

JITShortestGEDistances

public JITShortestGEDistances(IndexedGEDigraph ceDigraph,
                              GEPathMeter pathMeter)
                       throws GENegativeWeightCycleException
Method Detail

recalculate

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

Specified by:
recalculate in interface ShortestGEDistances
Specified by:
recalculate in class AbstractShortestGEDistances
GENegativeWeightCycleException

getLength

public int getLength(int from,
                     int to)
Specified by:
getLength in interface ShortestGEDistances
Overrides:
getLength in class AbstractShortestGEDistances


Copyright (c) 2001, 2002, David Walend