source: tmcsimulator/trunk/src/tmcsim/interfaces/SimulationControlInterface.java @ 2

Revision 2, 5.7 KB checked in by jdalbey, 10 years ago (diff)

Initial Import of project files

Line 
1package tmcsim.interfaces;
2
3import java.io.File;
4import java.rmi.Remote;
5import java.rmi.RemoteException;
6
7import tmcsim.cadmodels.CMSInfo;
8import tmcsim.client.cadclientgui.data.Incident;
9import tmcsim.common.ScriptException;
10
11/**
12 * RMI Interface providing methods for control of the simulation data. 
13 * This interface allows for registration of a remote SimulationManager.
14 * This object is notified of simulation information as the simulation
15 * runs.  Simulation control functionality includes starting, pausing,
16 * resetting, and moving the repositioning the simulation.  The
17 * SimulationControlInterface also provides methods to load a new
18 * script into the simulation, manually trigger incidents, delete
19 * current incidents, reschedule current incidents, and add new
20 * incidents.  The final control functionality allows new diversions
21 * to be applied to the simulation.
22 * 
23 * @author Matthew Cechini
24 * @version
25 */
26public interface SimulationControlInterface extends Remote {
27
28    /**
29     * Registers a remote SimulationManager for callback.  Only one
30     * SimulationManager can be connected at a time. The last one to
31     * connect will be referenced in the callback RMI.
32     *
33     * @param simManInt Interface to the SimulationManager for callback RMI
34     * @throws RemoteException if there is an error in the RMI communication.
35     */
36    public void registerForCallback(SimulationManagerInterface simManInt)
37        throws RemoteException;
38
39    /**
40     * Unregisters a remote SimulationManager from callback.  The coordinator
41     * will cease calling that SimulationManager with the updated simulation data.
42     *
43     * @param simManInt Interface to the SimulationManager for callback RMI
44     * @throws RemoteException if there is an error in the RMI communication.
45     */
46    public void unregisterForCallback(SimulationManagerInterface simManInt)
47        throws RemoteException;
48   
49    /**
50     * Starts the simualation.  Simulation time begins.
51     *
52     * @throws RemoteException if there is an error in the RMI communication.
53     * @throws ScriptException if a script has not been loaded.
54     */
55    public void startSimulation() throws RemoteException, ScriptException;
56
57    /**
58     * Pauses the simulation.  Simulation time is suspended.
59     *
60     * @throws RemoteException if error occurs in RMI
61     */
62    public void pauseSimulation() throws RemoteException;
63
64    /**
65     * Reset the simulation.  Counters are reset and local lists
66     * of simulation objects are cleared.
67     *
68     * throws RemoteException if error occurs in RMI
69     */
70    public void resetSimulation() throws RemoteException;
71
72    /**
73     * Reposition the simulation to a new time mark.  After repositioning,
74     * all incidents and events will exist in the simulation data.
75     *
76     * @param time The number of seconds to 'fast-forward' the simulation to.
77     * @throws RemoteException
78     */
79    public void gotoSimulationTime(long time) throws RemoteException;
80   
81    /**
82     * Loads a new script into the simulation.  Any existing script data
83     * is replaced by the new script data.
84     *
85     * @param scriptFile The script file to read into the coordinator
86     *
87     * @throws RemoteException if there is a problem in the RMI communication
88     * @throws ScriptException if there is an error in reading the script file
89     */
90    public void loadScriptFile(File scriptFile) throws RemoteException, ScriptException;
91   
92    /**
93     * Manually triggers an incident that has not yet occured in the simulation.
94     *
95     * @param incidentNumber Integer value of the incident number that is to be
96     * manually triggered.
97     *
98     * @throws RemoteException if there is an error in the RMI communication.
99     * @throws ScriptException if the simulation has not been started, or if a
100     * script has not been loaded.
101     */
102    public void triggerIncident(Integer incidentNumber) throws RemoteException, ScriptException;
103
104    /**
105     * Deletes an incident that has not yet occured from the simulation.
106     *
107     * @param incidentNumber Integer value of the incident number that is to be manually triggered.
108     *
109     * @throws RemoteException if there is an error in the RMI communication.
110     * @throws ScriptException if the incident that is being deleted has already occurred.
111     */
112    public void deleteIncident(Integer incidentNumber) throws RemoteException, ScriptException;
113
114    /**
115     * Reschedule an incident that has not yet occured in the simulation.
116     *
117     * @param incidentNumber Integer value of the incident number that is to be rescheduled.
118     * @param newTime Value (in seconds) of the new time the incident is to be scheduled for.
119     *
120     * @throws RemoteException if there is an error in the RMI communication.
121     * @throws ScriptException if the new time for this incident has already passed in the simulation
122     */
123    public void rescheduleIncident(Integer incidentNumber, long newTime)
124        throws RemoteException, ScriptException;
125
126    /**
127     * Add a new incident into the current simulation.
128     *
129     * @param newIncident Incident that is to be added to the simulation.
130     * @throws RemoteException if there is an error in the RMI communication.
131     */
132    public void addIncident(Incident newIncident) throws RemoteException;
133
134    /**
135     * Applies a new set of diversions for a specific CMS.  The new CMSInfo
136     * object is passed on to the CMSDiversionDB and updated information sent
137     * to the Paramics Communicator.
138     *
139     * @param theDiversion The CMSDiversion object containing the diversion information for a CMS.
140     * @throws RemoteException if there is an error in the RMI communication
141     */
142    public void applyDiversions(CMSInfo theDiversion) throws RemoteException;
143   
144}
Note: See TracBrowser for help on using the repository browser.