Class Flight

All Implemented Interfaces:
Serializable, Comparable<Object>, FlightNumber, IDBean, RoutePair, Cacheable
Direct Known Subclasses:
AssignmentLeg, FlightReport, ScheduleEntry, ScheduleSearchCriteria

public abstract class Flight extends DatabaseBean implements RoutePair, FlightNumber
A class to store Flight information.
Since:
1.0
Version:
10.0
Author:
Luke
See Also:
  • Constructor Details

    • Flight

      protected Flight(Airline a, int fNumber, int leg)
      Creates the bean.
      Parameters:
      a - the Airline
      fNumber - the flight number
      leg - the leg
  • Method Details

    • getLength

      public abstract int getLength()
      A method to return the length of the flight in hours multiplied by 10.
      Returns:
      the length of the flight
    • getDuration

      public abstract Duration getDuration()
      A method to return the exact length of the flight.
      Returns:
      a Duration
    • getDistance

      public int getDistance()
      Description copied from interface: RoutePair
      Returns the distance between the Airports.
      Specified by:
      getDistance in interface RoutePair
      Returns:
      the distance in miles
    • getAirline

      public Airline getAirline()
      Description copied from interface: FlightNumber
      Returns the Airline.
      Specified by:
      getAirline in interface FlightNumber
      Returns:
      the Airline
    • getFlightCode

      public String getFlightCode()
      Returns a text representation of the Flight in the format "CODE### Leg #".
      Returns:
      the flight code
      See Also:
    • getShortCode

      public String getShortCode()
      Returns the Flight code without the leg.
      Returns:
      the flight code
      See Also:
    • getLegCode

      public String getLegCode()
      Returns an abbreviated version of the Flight code with a dash instead of text.
      Returns:
      the flight code
      See Also:
    • getFlightNumber

      public int getFlightNumber()
      Description copied from interface: FlightNumber
      Returns the Flight Number.
      Specified by:
      getFlightNumber in interface FlightNumber
      Returns:
      the flight number
    • getLeg

      public int getLeg()
      Description copied from interface: FlightNumber
      Returns the Flight Leg.
      Specified by:
      getLeg in interface FlightNumber
      Returns:
      the leg
    • getEquipmentType

      public String getEquipmentType()
      Returns the Equipment type for this flight
      Returns:
      the equipment code
      See Also:
    • getAirportA

      public Airport getAirportA()
      Description copied from interface: RoutePair
      Returns the arrival Airport.
      Specified by:
      getAirportA in interface RoutePair
      Returns:
      the arrival Airport
    • getAirportD

      public Airport getAirportD()
      Description copied from interface: RoutePair
      Returns the departure Airport.
      Specified by:
      getAirportD in interface RoutePair
      Returns:
      the departure Airport
    • setAirline

      public void setAirline(Airline a)
      Set the Airline for this flight.
      Parameters:
      a - the Airline
      See Also:
    • setFlightNumber

      public void setFlightNumber(int fNumber)
      Set the Flight Number for this flight
      Parameters:
      fNumber - the Flight Number
      See Also:
    • setLeg

      public void setLeg(int leg)
      Sets the Flight leg for this flight
      Parameters:
      leg - the Flight leg
      Throws:
      IllegalArgumentException - if the flight leg is negative or > 8
      See Also:
    • setEquipmentType

      public void setEquipmentType(String eqType)
      Sets the equipment type for this flight.
      Parameters:
      eqType - the aircraft type
    • setAirportA

      public void setAirportA(Airport a)
      Sets the Arrival Airport object for this flight.
      Parameters:
      a - the Arrival Airport object
    • setAirportD

      public void setAirportD(Airport a)
      Sets the Departure Airport object for this flight.
      Parameters:
      a - the Departure Airport object
    • compareTo

      public int compareTo(Object o2)
      Specified by:
      compareTo in interface Comparable<Object>
      Overrides:
      compareTo in class DatabaseBean
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class DatabaseBean
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class DatabaseBean