1 // the class that describes a flight
3 public class Flight /*implements Cloneable*/ {
5 public String flightID; // the flight id
6 public int trialStatus; //
7 public Aircraft aircraftType; // the type of aircraft
8 public Track track; // data from radar
9 public Trajectory traject; // the estimated trajectory
10 public FlightPlan fPlan; // the associated flight plan
11 public String flightType; // the type of flight
12 private float horizAcc, vertAcc; // data used for estimating trajectory
14 public static int realFlightStatus(){ return -1;}
15 public static int trialFlightStatus(){ return 1;}
17 public Flight(String id) {
19 this.trialStatus=realFlightStatus();
22 public void setAircraftType (Aircraft ac) {
26 public void setFlightType(String flightType) {
27 this.flightType=flightType;
30 public void setTrack(Track newTrack) {
34 public void setFlightPlan(FlightPlan fp) {
38 public void updateTrajectory(D2 d2, double time) {
39 d2.getTrajectorySynthesizer().updateTrajectory(d2, time, this);
42 public boolean hasID (String id) {
43 return (flightID.compareTo(id)==0);
46 public boolean isFlying (String flType) {
47 return (flightType.compareTo(flType)==0);
50 public static Flight copyOf(Flight f) {
51 Flight fNew = disjoint flightCopy new Flight(f.flightID);
52 fNew.trialStatus = f.trialStatus;
53 fNew.aircraftType = f.aircraftType;
55 fNew.traject = f.traject;
57 fNew.flightType = f.flightType;
58 fNew.horizAcc = f.horizAcc;
59 fNew.vertAcc = f.vertAcc;
63 public String toString() {
64 return new String("Flight "+flightID+" Aircraft:"+aircraftType.type+
65 " Flight type:"+flightType+
66 " Cruise Altitude:"+fPlan.cruiseAlt+
67 " Cruise Speed:"+fPlan.cruiseSpeed+"\n"+fPlan.r);