b5bae9c52700a030c3b1810798ced48c072810ec
[IRC.git] / Robust / src / Benchmarks / mlp / directto / mlp-java / Flight.java
1 // the class that describes a flight
2
3 public class Flight /*implements Cloneable*/ {
4
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
13
14   public static int realFlightStatus(){ return -1;}
15   public static int trialFlightStatus(){ return 1;}  
16
17   public Flight(String id) {
18     this.flightID=id;
19     this.trialStatus=realFlightStatus();
20   }
21     
22   public void setAircraftType (Aircraft ac) {
23     this.aircraftType=ac;
24   }
25
26   public void setFlightType(String flightType) { 
27     this.flightType=flightType;
28   }
29   
30   public void setTrack(Track newTrack) {
31     this.track=newTrack;
32   }
33
34   public void setFlightPlan(FlightPlan fp) {
35     fPlan=fp;
36   }
37
38   public void updateTrajectory(D2 d2, double time) {
39     d2.getTrajectorySynthesizer().updateTrajectory(d2, time, this);
40   }
41
42   public boolean hasID (String id) {
43     return (flightID.compareTo(id)==0);
44   }
45
46   public boolean isFlying (String flType) {
47     return (flightType.compareTo(flType)==0);
48   }
49
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;
54     fNew.track        = f.track;
55     fNew.traject      = f.traject; 
56     fNew.fPlan        = f.fPlan;
57     fNew.flightType   = f.flightType; 
58     fNew.horizAcc     = f.horizAcc;
59     fNew.vertAcc      = f.vertAcc;
60     return fNew;
61   }
62         
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);
68   }
69 }