Initial commit
[debian/openrocket] / src / net / sf / openrocket / simulation / SimulationStatus.java
1 package net.sf.openrocket.simulation;
2
3 import java.util.HashSet;
4 import java.util.Set;
5
6 import net.sf.openrocket.aerodynamics.GravityModel;
7 import net.sf.openrocket.aerodynamics.WarningSet;
8 import net.sf.openrocket.aerodynamics.WindSimulator;
9 import net.sf.openrocket.rocketcomponent.Configuration;
10 import net.sf.openrocket.rocketcomponent.RecoveryDevice;
11 import net.sf.openrocket.util.Coordinate;
12
13
14 public class SimulationStatus implements Cloneable {
15         
16         public SimulationConditions startConditions;
17
18         public double time;
19         public Configuration configuration;
20         public FlightDataBranch flightData;
21         
22         public Coordinate position;
23         public Coordinate velocity;
24         
25         public WindSimulator windSimulator;
26         public GravityModel gravityModel;
27         
28         public double launchRodLength;
29         
30         
31         /** Nanosecond time when the simulation was started. */
32         public long simulationStartTime = Long.MIN_VALUE;
33         
34         
35         /** Set to true when a motor has ignited. */
36         public boolean motorIgnited = false;
37         
38         /** Set to true when the rocket has risen from the ground. */
39         public boolean liftoff = false;
40         
41         /** <code>true</code> while the rocket is on the launch rod. */
42         public boolean launchRod = true;
43
44         /** Set to true when apogee has been detected. */
45         public boolean apogeeReached = false;
46          
47         /** Contains a list of deployed recovery devices. */
48         public final Set<RecoveryDevice> deployedRecoveryDevices = new HashSet<RecoveryDevice>();
49         
50         
51         public WarningSet warnings;
52         
53         
54         /** Available for special purposes by the listeners. */
55         public Object extra = null;
56         
57         
58         /**
59          * Returns a (shallow) copy of this object.  The general purpose is that the 
60          * conditions, flight data etc. point to the same objects.  However, subclasses 
61          * are allowed to deep-clone specific objects, such as those pertaining to the 
62          * current orientation of the rocket.
63          */
64         @Override
65         public SimulationStatus clone() {
66                 try {
67                         return (SimulationStatus) super.clone();
68                 } catch (CloneNotSupportedException e) {
69                         throw new RuntimeException("BUG:  CloneNotSupportedException?!?",e);
70                 }
71         }
72 }