1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.formalisms.devs;
11
12 import java.io.Serializable;
13
14 import nl.tudelft.simulation.dsol.SimRuntimeException;
15
16 /***
17 * A SimEventInterface embodies the envolope in the scheduled method invocation
18 * information is stored.
19 * <p>
20 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
21 * University of Technology </a>, the Netherlands. <br>
22 * See for project information <a href="http://www.simulation.tudelft.nl">
23 * www.simulation.tudelft.nl </a> <br>
24 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
25 * License (GPL) </a>, no warranty <br>
26 *
27 * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
28 * Jacobs </a>
29 * @version 1.11 2004-03-26
30 * @since 1.0
31 */
32 public interface SimEventInterface extends Serializable, Comparable
33 {
34 /*** MAX_PRIORITY is a constant reflecting the maximum priority */
35 short MAX_PRIORITY = 10;
36
37 /*** NORMAL_PRIORITY is a constant reflecting the normal priority */
38 short NORMAL_PRIORITY = 5;
39
40 /*** MIN_PRIORITY is a constant reflecting the minimal priority */
41 short MIN_PRIORITY = 1;
42
43 /***
44 * executes the simEvent.
45 *
46 * @throws SimRuntimeException on execution failure
47 */
48 void execute() throws SimRuntimeException;
49
50 /***
51 * @return the scheduled execution time of a simulation event.
52 */
53 double getAbsoluteExecutionTime();
54
55 /***
56 * @return The priority of a simulation event. The priorities are programmed
57 * according to the Java thread priority. Use 10 (MAX_PRIORITY), -9, .. ,
58 * 5 (NORMAL_PRIORITY), 1(MIN_PRIORITY)
59 */
60 short getPriority();
61
62 /***
63 * sets the id of an event. Whenever a simulation event is added or removed
64 * from an eventlist, the list might want to set an ID for comparison. This
65 * is the only way to ensure a comparison on equal priority and execution
66 * time.
67 *
68 * @return retuns the id
69 */
70 long getID();
71
72 /***
73 * sets the id of an event. Whenever a simulation event is added or removed
74 * from an eventlist, the list might want to set an ID for comparison. This
75 * is the only way to ensure a comparison on equal priority and execution
76 * time.
77 *
78 * @param id the id
79 */
80 void setID(long id);
81 }