1 package net.sf.openrocket.simulation.listeners;
3 import net.sf.openrocket.simulation.SimulationStatus;
4 import net.sf.openrocket.simulation.exception.SimulationException;
8 public interface SimulationListener {
11 * Called when starting a simulation.
13 * @param status the simulation status.
15 public void startSimulation(SimulationStatus status) throws SimulationException;
19 * Called when ending a simulation. This is called either when the simulation ends normally
20 * (due to an end simulation event) or when a SimulationException is thrown.
22 * This method cannot throw a SimulationException, since the simulation is already being ended.
24 * @param status the simulation status.
25 * @param exception the exception that caused ending the simulation, or <code>null</code> if ending normally.
27 public void endSimulation(SimulationStatus status, SimulationException exception);
31 * Called before a simulation step is taken. This method may also prevent the normal
32 * stepping method from being called.
34 * @param status the simulation status.
35 * @return <code>true</code> to continue normally, <code>false</code> to skip taking the step
37 public boolean preStep(SimulationStatus status) throws SimulationException;
41 * Called immediately after a simulation step has been taken. This method is called whether the
42 * {@link #preStep(SimulationStatus)} aborted the step or not.
44 * @param status the simulation status.
46 public void postStep(SimulationStatus status) throws SimulationException;
50 * Return whether this is a system listener. System listeners are used internally for various
51 * purposes by OpenRocket. User-written listeners should always return <code>false</code>.
53 * System listeners do not cause warnings to be added to the simulation results when they affect
56 * @return whether this is a system listener
58 public boolean isSystemListener();