Initial commit
[debian/openrocket] / src / net / sf / openrocket / simulation / SimulationListener.java
1 package net.sf.openrocket.simulation;
2
3 import java.util.Collection;
4
5 import net.sf.openrocket.aerodynamics.AerodynamicForces;
6 import net.sf.openrocket.aerodynamics.FlightConditions;
7 import net.sf.openrocket.simulation.exception.SimulationException;
8
9
10
11 public interface SimulationListener {
12
13         
14         public void flightConditions(SimulationStatus status, FlightConditions conditions)
15                 throws SimulationException;
16         
17         
18         public void forceCalculation(SimulationStatus status, FlightConditions conditions,
19                         AerodynamicForces forces) throws SimulationException;
20         
21         
22         /**
23          * Called every time a simulation step has been taken.  The parameter contains the
24          * simulation status.  This method may abort the simulation by returning a
25          * <code>SIMULATION_END</code> event.  Note that this event and all others within
26          * the current time are still handled, so be careful not to create an infinite loop
27          * of events.
28          * 
29          * @param status        the current flight status.
30          * @return                      new flight events to handle, or <code>null</code> for none.
31          */
32         public Collection<FlightEvent> stepTaken(SimulationStatus status)
33                 throws SimulationException;
34         
35         
36         /**
37          * Called every time an event is handled by the simulation system.  The parameters
38          * contain the event and current simulation status.  This method may abort the 
39          * simulation by returning a <code>SIMULATION_END</code> event.  Note that this 
40          * event and all others within the current time are still handled, so be careful 
41          * not to create an infinite loop of events.
42          * 
43          * @param event         the event that triggered this call.
44          * @param status        the current flight status.
45          * @return                      new flight events to handle, or <code>null</code> for none.
46          */
47         public Collection<FlightEvent> handleEvent(FlightEvent event, SimulationStatus status)
48                 throws SimulationException;
49         
50 }