25529f54fac292bc7fcfc2221a620b268fd12e28
[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   private D2 d2;
6
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
15
16   public static int realFlightStatus(){ return -1;}
17   public static int trialFlightStatus(){ return 1;}  
18
19   public Flight(D2 d2, String id) {
20     this.d2=d2;
21     this.flightID=id;
22     this.trialStatus=realFlightStatus();
23   }
24     
25   public void setAircraftType (Aircraft ac) {
26     this.aircraftType=ac;
27   }
28   
29   public void setFlightType(String flightType) { 
30     this.flightType=flightType;
31   }
32   
33   public void setTrack(Track newTrack) {
34     this.track=newTrack;
35   }
36
37   public void setFlightPlan(FlightPlan fp) {
38     fPlan=fp;
39   }
40     
41   public void updateTrajectory(double time) {
42     d2.getTrajectorySynthesizer().updateTrajectory(time, this);
43   }
44
45   public boolean hasID (String id) {
46     return (flightID.compareTo(id)==0);
47   }
48
49   public boolean isFlying (String flType) {
50     return (flightType.compareTo(flType)==0);
51   }
52
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;
57     fNew.track        = f.track;
58     fNew.traject      = f.traject; 
59     fNew.fPlan        = f.fPlan;
60     fNew.flightType   = f.flightType; 
61     fNew.horizAcc     = f.horizAcc;
62     fNew.vertAcc      = f.vertAcc;
63     return fNew;
64   }
65         
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);
71   }
72 }