create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / simulation / listeners / SimulationListener.java
1 package net.sf.openrocket.simulation.listeners;
2
3 import java.util.List;
4
5 import net.sf.openrocket.simulation.FlightDataType;
6 import net.sf.openrocket.simulation.SimulationStatus;
7 import net.sf.openrocket.simulation.exception.SimulationException;
8
9
10
11 public interface SimulationListener {
12         
13         /**
14          * Get the name of this simulation listener.  Ideally this should be localized, as
15          * it can be displayed in the UI.
16          * 
17          * @return      the name of this simulation listener.
18          */
19         public String getName();
20         
21         
22         /**
23          * Get the menu position of this simulation listener.  This should be an array
24          * of localized submenu names in descending order, or an empty array for positioning
25          * in the base menu.
26          * 
27          * @return      the menu position of this simulation listener.
28          */
29         public String[] getMenuPosition();
30         
31         
32         /**
33          * Called when starting a simulation.
34          * 
35          * @param status        the simulation status.
36          */
37         public void startSimulation(SimulationStatus status) throws SimulationException;
38         
39         
40         /**
41          * Called when ending a simulation.  This is called either when the simulation ends normally
42          * (due to an end simulation event) or when a SimulationException is thrown.
43          * <p>
44          * This method cannot throw a SimulationException, since the simulation is already being ended.
45          * 
46          * @param status        the simulation status.
47          * @param exception     the exception that caused ending the simulation, or <code>null</code> if ending normally.
48          */
49         public void endSimulation(SimulationStatus status, SimulationException exception);
50         
51         
52         /**
53          * Called before a simulation step is taken.  This method may also prevent the normal
54          * stepping method from being called.
55          * 
56          * @param status        the simulation status.
57          * @return                      <code>true</code> to continue normally, <code>false</code> to skip taking the step
58          */
59         public boolean preStep(SimulationStatus status) throws SimulationException;
60         
61         
62         /**
63          * Called immediately after a simulation step has been taken.  This method is called whether the
64          * {@link #preStep(SimulationStatus)} aborted the step or not.
65          * 
66          * @param status        the simulation status.
67          */
68         public void postStep(SimulationStatus status) throws SimulationException;
69         
70         
71         /**
72          * Return whether this is a system listener.  System listeners are used internally for various
73          * purposes by OpenRocket.  User-written listeners should always return <code>false</code>.
74          * <p>
75          * System listeners do not cause warnings to be added to the simulation results when they affect
76          * the simulation.
77          * 
78          * @return              whether this is a system listener
79          */
80         public boolean isSystemListener();
81         
82         
83         /**
84          * Return a list of any flight data types this listener creates.
85          */
86         public FlightDataType[] getFlightDataTypes();
87         
88         
89 }