1 // the class that describes a flight
3 public class Flight /*implements Cloneable*/ {
7 public String flightID; // the flight id
8 public int trialStatus; //
9 public Aircraft aircraftType; // the type of aircraft
10 public Track track; // data from radar
11 public Trajectory traject; // the estimated trajectory
12 public FlightPlan fPlan; // the associated flight plan
13 public String flightType; // the type of flight
14 private float horizAcc, vertAcc; // data used for estimating trajectory
16 public static int realFlightStatus(){ return -1;}
17 public static int trialFlightStatus(){ return 1;}
19 public Flight(D2 d2, String id) {
22 this.trialStatus=realFlightStatus();
25 public void setAircraftType (Aircraft ac) {
29 public void setFlightType(String flightType) {
30 this.flightType=flightType;
33 public void setTrack(Track newTrack) {
37 public void setFlightPlan(FlightPlan fp) {
41 public void updateTrajectory(double time) {
42 d2.getTrajectorySynthesizer().updateTrajectory(time, this);
45 public boolean hasID (String id) {
46 return (flightID.compareTo(id)==0);
49 public boolean isFlying (String flType) {
50 return (flightType.compareTo(flType)==0);
53 public static Flight copyOf( D2 d2, Flight f) {
54 Flight fNew = disjoint flightCopy new Flight(d2, f.flightID);
55 fNew.trialStatus = f.trialStatus;
56 fNew.aircraftType = f.aircraftType;
58 fNew.traject = f.traject;
60 fNew.flightType = f.flightType;
61 fNew.horizAcc = f.horizAcc;
62 fNew.vertAcc = f.vertAcc;
66 public String toString() {
67 return new String("Flight "+flightID+" Aircraft:"+aircraftType.type+
68 " Flight type:"+flightType+
69 " Cruise Altitude:"+fPlan.cruiseAlt+
70 " Cruise Speed:"+fPlan.cruiseSpeed+"\n"+fPlan.r);