Example #1
0
 /**
  * find all route that contain that departure
  *
  * @param Departure String
  * @return Route ArrayList
  */
 public ArrayList<Route> findRouteDepart(String departure) {
   ArrayList<Route> resultRoutes = new ArrayList<Route>();
   for (int i = 0; i < routeList.size(); i++) {
     Route tempRoute = routeList.get(i);
     if (tempRoute.getDeparture().equals(departure)) resultRoutes.add(tempRoute);
   }
   return resultRoutes;
 }
Example #2
0
 /**
  * check the route is valid or not
  *
  * @return Route
  */
 public Route findRoute(String departure, String destination) {
   for (int i = 0; i < routeList.size(); i++) {
     Route tempRoute = routeList.get(i);
     if (tempRoute.getDeparture() == departure && tempRoute.getDestination() == destination)
       return tempRoute;
   }
   return null;
 }
Example #3
0
  /**
   * Instantiates a new Path finding
   *
   * @param departure
   * @param destination
   * @throws IOException Signals that an I/O exception has occurred.
   */
  public void addRouteRow(String depart, String dest, int distance) {
    Route r = new Route();
    r.setDeparture(depart);
    r.setDestination(dest);
    r.setDistance(distance);
    /* Data for testing, should use the real data in CSV file.
    List<Flight> fList = fetchAllFlights();

    FlightListFilter flf = new FlightListFilter(fList);
    r.setFlights(flf.filterByDepartNDest(depart, dest));
    Data for testing, should use the real data in CSV file. */

    routeList.add(r);
  }