faa.tg.nas.flight
Class Flight

java.lang.Object
  extended by faa.tg.nas.flight.Flight
All Implemented Interfaces:
HasName, Filterable, RecordableState, ManagedObject, java.io.Serializable

public class Flight
extends java.lang.Object
implements java.io.Serializable, RecordableState, HasName

 Flight is a class which defines the flight scheduled for an aircraft 
 Further definition must be done.
 
See the source: Flight.java

Version:
$Id: Flight.java,v 3.33 2008/12/12 20:19:53 lykensj Exp $
Author:
Jocelyn Richardt
See Also:
Serialized Form

Nested Class Summary
private static class Flight.GroundPart
           
 
Field Summary
private  AcType acType
          The type of A/C i.e.
private  Aircraft aircraft
          The Aircraft associated with this Flight.
private  java.lang.String airLine
          The Airline this flight is flying for
private  Airport arrivalAirport
          The Airport at which the Flight is planned to land.
private  Runway arrivalRunway
          The Runway at which the Flight is planned to land.
private  int complexity
          The complexity level at which this Flight will be included in the simulation.
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
static int DEFAULT_COMPLEXITY
           
private  Airport departureAirport
          The Airport from which the Flight is planned to depart.
private  Runway departureRunway
          The Runway from which the Flight is planned to depart.
private  Route filedRoute
          The Route as a Object FIXME made this transient because the simEventActions tag along.
private  java.lang.String filedRouteString
          The Route as a string
private  SimulationTime filedStartTime
          The start time filed in the UFP
private  Flight.GroundPart ground
           
private  java.lang.String groundArrivalString
          Deprecated.  
private  java.lang.String groundDepartureString
          Deprecated.  
private  java.lang.String nasRouteString
           
(package private) static long serialVersionUID
           
private  SpID spId
          The Simpilot ID of this flight.
private  SimulationTime startTime
          Time when the flight is starting.
private  Altitude targetAltitude
           
private  GenericSpeed targetSpeed
           
private  Ufp ufp
          The Universal Flight Plan for this object.
 
Constructor Summary
private Flight(Flight other, Scenario scenario)
           
  Flight(Ufp ufp, Aircraft ac, SimulationTime startTime, int complexity, AcType acType, java.lang.String routeString, java.lang.String airline)
          Constructor for dead reckoned aircraft.
  Flight(Ufp ufp, Aircraft ac, SimulationTime startTime, int complexity, AcType acType, java.lang.String routeString, java.lang.String airline, Altitude targetAlt, java.lang.String groundDep, java.lang.String groundArr)
          Constructor.
  Flight(Ufp flightPlan, Scenario scenario, boolean strictRoute)
          Constructs a Flight from a Ufp.
 
Method Summary
private  void configureDatalink()
           
private  Altitude findAltitudes()
           
private  void findArrivalAirportAndRunway()
          Finds and sets the arrival airport and arrival ruwnay based on filedRoute.
private  void findDepartureAirportAndRunway()
          Finds and sets the departure airport and departure ruwnay based on filedRoute.
 Acid getAcid()
           
 AcType getAcType()
          The type of A/C, i.e.
 Aircraft getAircraft()
           
 java.lang.String getAirLine()
           
 Airport getArrivalAirport()
          Returns the Airport at which the flight is planned to land or null if the Flight is not planned to land in the Simulation.
 Runway getArrivalRunway()
          Returns the Runway at which the flight is planned to land or null if the Flight is not planned to land in the Simulation.
 int getComplexity()
           
 Airport getDepartureAirport()
          Returns the Airport at which the flight is planned to depart or null if the Flight is not planned to depart in the Simulation.
 Runway getDepartureRunway()
          Returns the Runway at which the flight is planned to depart or null if the Flight is not planned to depart in the Simulation.
 Route getFiledRoute()
           
 java.lang.String getFiledRouteString()
           
 SimulationTime getFiledStartTime()
          Returns the start time filed in the flight plan.
 FlightState getFlightState()
          Gets the recordable FlightState for this flight.
 GroundFlight getGroundInformation()
           
 java.lang.String getName()
          Returns a unique identifier for the Flight to implement HasName.
 java.lang.String getNasRouteString()
           
 Recordable getRecordable()
          Get a Recordable (must be Serializable) version of this object.
 SpID getSpId()
          Gets the ID of the SimPilotStation that this is assigned to
 SimulationTime getStartTime()
           
 Altitude getTargetAltitude()
           
 GenericSpeed getTargetSpeed()
           
 Ufp getUfp()
          Returns the UFP object for this flight.
private  void initializeAircraft(Altitude startAlt, Route route, Atmosphere atmosphere)
          Initializes the dynamics of the aircraft.
private static GenericSpeed parseStartSpeed(Ufp ufp, Position position, Atmosphere atmo)
          Parses start speed from ufp
private static GenericSpeed parseTargetSpeed(Ufp ufp, Position position, Altitude targetAlt, Atmosphere atmosphere)
          Parses target speed from UFP: if not specified, there are no speed restrictions on the aircraft and null is returned.
private  void readObject(java.io.ObjectInputStream stream)
          Restores the aircraft object from an ObjectInputStream, with a newly constructed UpdateCompleteListenerList.
 void setArrivalAirport(Airport arrivalAirport)
           
 void setArrivalRunway(Runway arrivalRunway)
           
 void setDepartureAirport(Airport departureAirport)
           
 void setDepartureRunway(Runway departureRunway)
           
 void setFiledRoute(Route route)
           
 void setSpId(SpID spId)
          Sets the ID of the SimPilotStation that this is assigned to
 void setStartTime(SimulationTime newStartTime)
          This method was put in so that departure manager could update startTime.
 void setTargetSpeed(GenericSpeed targetSpeed)
          Set target speed to use as a speed restriction (null if unrestricted).
 Flight split(Scenario scenario)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID

See Also:
Constant Field Values

DEFAULT_COMPLEXITY

public static final int DEFAULT_COMPLEXITY
See Also:
Constant Field Values

startTime

private SimulationTime startTime
Time when the flight is starting.


aircraft

private final Aircraft aircraft
The Aircraft associated with this Flight.


complexity

private int complexity
The complexity level at which this Flight will be included in the simulation. Levels from 1 thru 5. Level 1 is in all simulations.


acType

private AcType acType
The type of A/C i.e. B727 etc.. Unlike the aircraft, the flight stores the type of the aircraft that it thinks it is (as opposed to the equivalency type). this type also has the navigation equipment appended onto it. It is used for presentation only.


airLine

private java.lang.String airLine
The Airline this flight is flying for


filedRouteString

private java.lang.String filedRouteString
The Route as a string


nasRouteString

private java.lang.String nasRouteString

groundDepartureString

private final transient java.lang.String groundDepartureString
Deprecated. 
No longer serialized on 08/14/08

See Also:
Constant Field Values

groundArrivalString

private final transient java.lang.String groundArrivalString
Deprecated. 
No longer serialized on 08/14/08

See Also:
Constant Field Values

filedStartTime

private SimulationTime filedStartTime
The start time filed in the UFP


filedRoute

private transient Route filedRoute
The Route as a Object FIXME made this transient because the simEventActions tag along.


spId

private transient SpID spId
The Simpilot ID of this flight. I could have used an old variable, but I want to pull all that stuff out later, and it will be easier if they're disconnected. The simulator(s) will not do anything with this value. They'll just be given it in a simpilot command, and spit it out in the Aircraft state. It just needs to be here, because the data feed from the simulator is the only way that we can have a) aircraft go on a specified display b) reliable front/back panel decision making


ufp

private Ufp ufp
The Universal Flight Plan for this object.


arrivalAirport

private Airport arrivalAirport
The Airport at which the Flight is planned to land.


departureAirport

private Airport departureAirport
The Airport from which the Flight is planned to depart.


arrivalRunway

private Runway arrivalRunway
The Runway at which the Flight is planned to land.


departureRunway

private Runway departureRunway
The Runway from which the Flight is planned to depart.


targetAltitude

private Altitude targetAltitude

targetSpeed

private GenericSpeed targetSpeed

ground

private final transient Flight.GroundPart ground
Constructor Detail

Flight

public Flight(Ufp ufp,
              Aircraft ac,
              SimulationTime startTime,
              int complexity,
              AcType acType,
              java.lang.String routeString,
              java.lang.String airline,
              Altitude targetAlt,
              java.lang.String groundDep,
              java.lang.String groundArr)
Constructor.

Parameters:
ufp - The Universal Flight Plan fields.
ac - The aircraft object.
startTime - The aircraft's start time.
complexity - Simulation complexity this aircraft is visible at.
acType - The aircraft type.
routeString - The route of the aircraft.
airline - The airline of the aircraft.
targetAlt - Target altitude from the flight plan (may be null).
groundDep - Ground departure info (null if not ground departure).
groundArr - Ground arrival info (null if not ground arrival).

Flight

private Flight(Flight other,
               Scenario scenario)
        throws java.lang.CloneNotSupportedException,
               PathNotFoundException
Throws:
java.lang.CloneNotSupportedException
PathNotFoundException

Flight

public Flight(Ufp ufp,
              Aircraft ac,
              SimulationTime startTime,
              int complexity,
              AcType acType,
              java.lang.String routeString,
              java.lang.String airline)
Constructor for dead reckoned aircraft.


Flight

public Flight(Ufp flightPlan,
              Scenario scenario,
              boolean strictRoute)
       throws FlightPlanException
Constructs a Flight from a Ufp. This sets the fields of this Flight and constructs and initializes its corresponding Aircraft and constructs and initializes the Aircrafts's Dynamics. Checking for valid flying routes is optional; however, any ground aircraft require a valid flying route.

Parameters:
flightPlan - the source of the data for this flight.
strictRoute - if true, this constructor will throw a FlightPlanException on invalid flying routes.
Throws:
FlightPlanException - if the Fligh cannot be constructed.
Method Detail

setStartTime

public void setStartTime(SimulationTime newStartTime)
This method was put in so that departure manager could update startTime.

Parameters:
newStartTime - - The new start time

setTargetSpeed

public void setTargetSpeed(GenericSpeed targetSpeed)
Set target speed to use as a speed restriction (null if unrestricted).


getFiledStartTime

public SimulationTime getFiledStartTime()
Returns the start time filed in the flight plan.


getAcid

public Acid getAcid()

getStartTime

public SimulationTime getStartTime()

getAircraft

public Aircraft getAircraft()

getComplexity

public int getComplexity()

getFiledRouteString

public java.lang.String getFiledRouteString()

getTargetAltitude

public Altitude getTargetAltitude()

getTargetSpeed

public GenericSpeed getTargetSpeed()

getAcType

public AcType getAcType()
The type of A/C, i.e. B727, etc. Unlike the aircraft, the flight stores the type of the aircraft that it thinks it is (as opposed to the equivalency type). this type also has the navigation equipment appended onto it. It is used for presentation only.


getName

public java.lang.String getName()
Returns a unique identifier for the Flight to implement HasName. If looking for the ACID, please use getAcid() instead.

Specified by:
getName in interface ManagedObject
Returns:
Returns the name of the object.

getAirLine

public java.lang.String getAirLine()

setFiledRoute

public void setFiledRoute(Route route)

getFiledRoute

public Route getFiledRoute()

setArrivalAirport

public void setArrivalAirport(Airport arrivalAirport)

setDepartureAirport

public void setDepartureAirport(Airport departureAirport)

setArrivalRunway

public void setArrivalRunway(Runway arrivalRunway)

setDepartureRunway

public void setDepartureRunway(Runway departureRunway)

getUfp

public Ufp getUfp()
Returns the UFP object for this flight. return the UFP object associated with this flight; null if no UFP exists.


getDepartureAirport

public Airport getDepartureAirport()
Returns the Airport at which the flight is planned to depart or null if the Flight is not planned to depart in the Simulation.


getArrivalAirport

public Airport getArrivalAirport()
Returns the Airport at which the flight is planned to land or null if the Flight is not planned to land in the Simulation.


getDepartureRunway

public Runway getDepartureRunway()
Returns the Runway at which the flight is planned to depart or null if the Flight is not planned to depart in the Simulation.


getArrivalRunway

public Runway getArrivalRunway()
Returns the Runway at which the flight is planned to land or null if the Flight is not planned to land in the Simulation.


readObject

private void readObject(java.io.ObjectInputStream stream)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Restores the aircraft object from an ObjectInputStream, with a newly constructed UpdateCompleteListenerList.

Parameters:
stream - Stream to read the Flight object from.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRecordable

public Recordable getRecordable()
Description copied from interface: RecordableState
Get a Recordable (must be Serializable) version of this object.

Specified by:
getRecordable in interface RecordableState
Returns:
The subset of Recordable information for this object.

getFlightState

public FlightState getFlightState()
Gets the recordable FlightState for this flight.

Returns:
Return a recordable FlightState object.

getGroundInformation

public GroundFlight getGroundInformation()

getSpId

public SpID getSpId()
Gets the ID of the SimPilotStation that this is assigned to


setSpId

public void setSpId(SpID spId)
Sets the ID of the SimPilotStation that this is assigned to

Parameters:
spId - to assign this to

initializeAircraft

private void initializeAircraft(Altitude startAlt,
                                Route route,
                                Atmosphere atmosphere)
                         throws FlightPlanException,
                                UnableToComplyException
Initializes the dynamics of the aircraft.

Parameters:
startAlt - the aircraft's starting altitude.
route - the aircraft's starting route.
atmosphere - the global atmospheric conditions.
Throws:
FlightPlanException - for bad routes, checked in this method.
UnableToComplyException - for bad routes, checked at the Controller level..

configureDatalink

private void configureDatalink()

findArrivalAirportAndRunway

private void findArrivalAirportAndRunway()
Finds and sets the arrival airport and arrival ruwnay based on filedRoute.


findDepartureAirportAndRunway

private void findDepartureAirportAndRunway()
                                    throws FlightPlanException
Finds and sets the departure airport and departure ruwnay based on filedRoute.

Throws:
FlightPlanException

parseTargetSpeed

private static GenericSpeed parseTargetSpeed(Ufp ufp,
                                             Position position,
                                             Altitude targetAlt,
                                             Atmosphere atmosphere)
Parses target speed from UFP: if not specified, there are no speed restrictions on the aircraft and null is returned.

Parameters:
position - Used to convert TAS to indicated airspeed.
targetAlt - The target altitude string from the UFP.
Returns:
Mach speed or the IAS equivalent of the TAS parsed from the UFP.

findAltitudes

private Altitude findAltitudes()

parseStartSpeed

private static GenericSpeed parseStartSpeed(Ufp ufp,
                                            Position position,
                                            Atmosphere atmo)
Parses start speed from ufp

Parameters:
position - used to find indicatedAirspeed
Returns:
indicatedAirspeed parsed from UFP

split

public Flight split(Scenario scenario)
             throws java.lang.CloneNotSupportedException,
                    PathNotFoundException
Throws:
java.lang.CloneNotSupportedException
PathNotFoundException

getNasRouteString

public java.lang.String getNasRouteString()