Class RoutePathHelper

java.lang.Object
org.deltava.beans.schedule.RoutePathHelper

public final class RoutePathHelper extends Object
A utility class that uses Dijkstra's algorithm to calculate the shortest multi-airport leg.
Since:
7.5
Version:
11.2
Author:
Luke
  • Constructor Details

    • RoutePathHelper

      public RoutePathHelper(int legCost, int historicCost)
      Creates the helper bean.
      Parameters:
      legCost - the flat extra cost of each additional leg in miles, to prioritize fewer legs over absolute distance
      historicCost - the flat extra cost of route pair served only by historical flights
  • Method Details

    • setLinks

      public void setLinks(Collection<ScheduleRoute> links)
      Populates the links between the airports.
      Parameters:
      links - a Collection of ScheduleRoutes
    • getShortestPath

      public Collection<RoutePair> getShortestPath(RoutePair rp)
      Calculates the shortest path between two Airports.
      Parameters:
      rp - the RoutePair
      Returns:
      a Collection of RoutePair legs, or empty if no route found