airline
Class Airport

java.lang.Object
  extended by airline.Airport

public class Airport
extends java.lang.Object


Constructor Summary
Airport()
          Creates a new instance of Airport.
Airport(java.lang.String code, java.lang.String name, java.lang.String city, java.lang.String state, java.lang.String region)
          Creates a new instance of Airport - want all of this stuff - default to it is the main airport
Airport(java.lang.String code, java.lang.String name, java.lang.String city, java.lang.String state, java.lang.String region, boolean main)
          Creates a new instance of Airport - all info passes
 
Method Summary
 void displayAirport(java.io.PrintWriter outpw)
          display to a file the string representation of the airport
 java.lang.String getAirportCity()
          report airport city
 java.lang.String getAirportCode()
          report airport code
 java.lang.String getAirportName()
          report airport name
 java.lang.String getAirportRegion()
          report airport region - right now just a string.
 java.lang.String getAirportState()
          report airport state
 boolean getMainAirportForCity()
          report whether airport is the main airport for the city
 boolean isUnknownAirport()
          indicates if the airport is an unknown airport - probably either not initialized yet, or a problem exists Checks airport code to see if it is "UNK"
 void readAirport(java.io.BufferedReader bReader)
          read airport info from a file, sticking in the invoking Airport object
 int readAirportFromFile(java.io.BufferedReader bReader)
          read an airport from a file.
 void setAirportCity(java.lang.String city)
          change airport city.
 boolean setAirportCode(java.lang.String code)
          change airport code.
 void setAirportName(java.lang.String name)
          change airport name.
 void setAirportRegion(java.lang.String region)
          set airport region - later use an enumerated type
 boolean setAirportState(java.lang.String state)
          change airport state.
 void setMainAirportForCity(boolean main)
          change whether airport is main airport for the city
 java.lang.String toShortString()
          provides more compact summary of the airport
 java.lang.String toString()
          return a string representation of an airport with labels on data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Airport

public Airport()
Creates a new instance of Airport. Default version for if no info is available yet. airportCode of "UNK" indicates that it is not a legitimate airport


Airport

public Airport(java.lang.String code,
               java.lang.String name,
               java.lang.String city,
               java.lang.String state,
               java.lang.String region)
Creates a new instance of Airport - want all of this stuff - default to it is the main airport


Airport

public Airport(java.lang.String code,
               java.lang.String name,
               java.lang.String city,
               java.lang.String state,
               java.lang.String region,
               boolean main)
Creates a new instance of Airport - all info passes

Method Detail

getAirportCode

public java.lang.String getAirportCode()
report airport code


isUnknownAirport

public boolean isUnknownAirport()
indicates if the airport is an unknown airport - probably either not initialized yet, or a problem exists Checks airport code to see if it is "UNK"


getAirportName

public java.lang.String getAirportName()
report airport name


getAirportCity

public java.lang.String getAirportCity()
report airport city


getAirportState

public java.lang.String getAirportState()
report airport state


getAirportRegion

public java.lang.String getAirportRegion()
report airport region - right now just a string. May become an enumerated type


getMainAirportForCity

public boolean getMainAirportForCity()
report whether airport is the main airport for the city


setAirportCode

public boolean setAirportCode(java.lang.String code)
change airport code. Must be 3 character. Should also check that it is non-numeric etc


setAirportName

public void setAirportName(java.lang.String name)
change airport name. Not validatable


setAirportCity

public void setAirportCity(java.lang.String city)
change airport city. not able to be validated.


setAirportState

public boolean setAirportState(java.lang.String state)
change airport state. For now, only validate that the length is 2 (returning true or false). Could later do a DB search or other lookup


setAirportRegion

public void setAirportRegion(java.lang.String region)
set airport region - later use an enumerated type


setMainAirportForCity

public void setMainAirportForCity(boolean main)
change whether airport is main airport for the city


toString

public java.lang.String toString()
return a string representation of an airport with labels on data. Overrides Object class version

Overrides:
toString in class java.lang.Object

toShortString

public java.lang.String toShortString()
provides more compact summary of the airport


displayAirport

public void displayAirport(java.io.PrintWriter outpw)
display to a file the string representation of the airport


readAirportFromFile

public int readAirportFromFile(java.io.BufferedReader bReader)
                        throws java.io.IOException
read an airport from a file. Doesn't do much more than the method it calls

Throws:
java.io.IOException

readAirport

public void readAirport(java.io.BufferedReader bReader)
                 throws java.io.IOException
read airport info from a file, sticking in the invoking Airport object

Throws:
java.io.IOException