1 package org.opentrafficsim.core.dsol;
2
3 import java.rmi.RemoteException;
4
5 import nl.tudelft.simulation.dsol.SimRuntimeException;
6 import nl.tudelft.simulation.dsol.experiment.Replication;
7 import nl.tudelft.simulation.dsol.experiment.ReplicationMode;
8 import nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock;
9
10 import org.djunits.unit.TimeUnit;
11 import org.djunits.value.vdouble.scalar.DoubleScalar;
12 import org.djunits.value.vdouble.scalar.Duration;
13 import org.djunits.value.vdouble.scalar.Time;
14
15
16
17
18
19
20
21
22
23
24 public class OTSDEVSRealTimeClock extends
25 DEVSRealTimeClock<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble> implements
26 OTSDEVSSimulatorInterface, OTSAnimatorInterface
27 {
28
29 private static final long serialVersionUID = 20140909L;
30
31
32
33
34 public OTSDEVSRealTimeClock()
35 {
36 super();
37 }
38
39
40 @Override
41 public final void initialize(
42 final Replication<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble> initReplication,
43 final ReplicationMode replicationMode) throws SimRuntimeException
44 {
45 try
46 {
47 super.initialize(initReplication, replicationMode);
48 }
49 catch (RemoteException exception)
50 {
51 throw new SimRuntimeException(exception);
52 }
53 }
54
55
56 @Override
57 public final void scheduleEventRel(final Duration relativeDelay, final short priority, final Object source,
58 final Object target, final String method, final Object[] args) throws SimRuntimeException
59 {
60 super.scheduleEventRel(relativeDelay, priority, source, target, method, args);
61 }
62
63
64 @Override
65 public final void scheduleEventRel(final Duration relativeDelay, final Object source, final Object target,
66 final String method, final Object[] args) throws SimRuntimeException
67 {
68 super.scheduleEventRel(relativeDelay, source, target, method, args);
69 }
70
71
72 @Override
73 public final void scheduleEventAbs(final Time absoluteTime, final Object source, final Object target,
74 final String method, final Object[] args) throws SimRuntimeException
75 {
76 super.scheduleEventAbs(absoluteTime, source, target, method, args);
77 }
78
79
80 @Override
81 public final void scheduleEventAbs(final Time absoluteTime, final short priority, final Object source,
82 final Object target, final String method, final Object[] args) throws SimRuntimeException
83 {
84 super.scheduleEventAbs(absoluteTime, priority, source, target, method, args);
85 }
86
87
88 @Override
89 public final void runUpTo(final Time when) throws SimRuntimeException
90 {
91 super.runUpTo(when);
92 }
93
94
95 @Override
96 protected final Duration relativeMillis(final double factor)
97 {
98 return new Duration(factor, TimeUnit.MILLISECOND);
99 }
100
101
102 @Override
103 public final String toString()
104 {
105 return "OTSDEVSRealTimeClock [time=" + getSimulatorTime().getTime() + "]";
106 }
107
108 }