airline
Class CollectRoutes

java.lang.Object
  extended by airline.CollectRoutes

public class CollectRoutes
extends java.lang.Object


Constructor Summary
CollectRoutes()
          Creates a new instance of CollectRoutes.
 
Method Summary
 boolean addNextRoute(Route currRoute)
          adding route to the collection
 void displayAllRoutes(java.io.PrintWriter outpw)
          displays to a file all current routes.
 Route getNthRoute(int nth)
          report a particular route (by position in the collection)
 int getNumRoutes()
          report how many actual routes are in the collection
 Route getRouteByCode(java.lang.String depart, java.lang.String arriv)
          Get route corresponding to passed airport codes (returns unknown route if not found)
 int readRoutesFromFile(java.lang.String filename, CollectAirports allAirports)
          create a collection of routes via reading a file (filename is passed).
 boolean setNthRoute(Route currRoute, int num)
          change a particular route (by position in the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectRoutes

public CollectRoutes()
Creates a new instance of CollectRoutes. All references are empty (none instantiated)

Method Detail

getNumRoutes

public int getNumRoutes()
report how many actual routes are in the collection


displayAllRoutes

public void displayAllRoutes(java.io.PrintWriter outpw)
displays to a file all current routes. Needs a PrintWriter, which can be obtained using the HandleFile class


addNextRoute

public boolean addNextRoute(Route currRoute)
adding route to the collection


getNthRoute

public Route getNthRoute(int nth)
report a particular route (by position in the collection)


setNthRoute

public boolean setNthRoute(Route currRoute,
                           int num)
change a particular route (by position in the collection. Returns false if the route has not already been instantiated. Use add method to add a completely new route


getRouteByCode

public Route getRouteByCode(java.lang.String depart,
                            java.lang.String arriv)
Get route corresponding to passed airport codes (returns unknown route if not found)


readRoutesFromFile

public int readRoutesFromFile(java.lang.String filename,
                              CollectAirports allAirports)
create a collection of routes via reading a file (filename is passed). Also needs collection of airports, so route can be constructed from airports while the input only includes codes. Needs my HandleFile class and File library. If there is a problem with the file we ditch the application; the file needs to be fixed.