airline
Class CollectAirports

java.lang.Object
  extended by airline.CollectAirports

public class CollectAirports
extends java.lang.Object


Constructor Summary
CollectAirports()
          Creates a new instance of CollectAirports.
 
Method Summary
 boolean addNextAirport(Airport currAirport)
          adding airport to the collection
 void displayAllAirports(java.io.PrintWriter outpw)
          displays all current airports to a file.
 Airport getAirportByCode(java.lang.String code)
          Get airport corresponding to passed airport code (returns unknown airport if not found)
 Airport getNthAirport(int nth)
          pick out an airport - by position in the collection
 int getNumAirports()
          report how many actual airports are currently stored in the collection
 int readAirportsFromFile(java.lang.String filename)
          create a collection of airports via reading a file (filename is passed).
 boolean setNthAirport(Airport currAirport, int num)
          change a specific airport in the collection (by position).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectAirports

public CollectAirports()
Creates a new instance of CollectAirports. This is an empty array. None of the references are filled in.

Method Detail

getNumAirports

public int getNumAirports()
report how many actual airports are currently stored in the collection


displayAllAirports

public void displayAllAirports(java.io.PrintWriter outpw)
displays all current airports to a file. requires a print writer - which can be obtained using the HandleFile class


addNextAirport

public boolean addNextAirport(Airport currAirport)
adding airport to the collection


getNthAirport

public Airport getNthAirport(int nth)
pick out an airport - by position in the collection


setNthAirport

public boolean setNthAirport(Airport currAirport,
                             int num)
change a specific airport in the collection (by position). Returns false if the position has not been instantiated yet. Use add method to add a new airport instead of changing


getAirportByCode

public Airport getAirportByCode(java.lang.String code)
Get airport corresponding to passed airport code (returns unknown airport if not found)


readAirportsFromFile

public int readAirportsFromFile(java.lang.String filename)
create a collection of airports via reading a file (filename is passed). Depends on my HandleFile class. If there is a problem with the file, we exit the application - the file needs to be fixed. This assumes that the file is in the top folder for the project.