View Javadoc
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.Time;
13  
14  /**
15   * <p>
16   * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
17   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
18   * <p>
19   * @version $Revision: 1668 $, $LastChangedDate: 2015-12-29 03:56:14 +0100 (Tue, 29 Dec 2015) $, by $Author: averbraeck $,
20   *          initial version Aug 15, 2014 <br>
21   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
22   */
23  public class OTSDEVSRealTimeClock extends
24      DEVSRealTimeClock<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble> implements
25      OTSDEVSSimulatorInterface, OTSAnimatorInterface
26  {
27      /** */
28      private static final long serialVersionUID = 20140909L;
29  
30      /**
31       * Create a new OTSRealTimeClock.
32       */
33      public OTSDEVSRealTimeClock()
34      {
35          super();
36      }
37  
38      /** {@inheritDoc} */
39      @Override
40      public final void initialize(
41          final Replication<DoubleScalar.Abs<TimeUnit>, DoubleScalar.Rel<TimeUnit>, OTSSimTimeDouble> initReplication,
42          final ReplicationMode replicationMode) throws SimRuntimeException
43      {
44          try
45          {
46              super.initialize(initReplication, replicationMode);
47          }
48          catch (RemoteException exception)
49          {
50              throw new SimRuntimeException(exception);
51          }
52      }
53  
54      /** {@inheritDoc} */
55      @Override
56      public final void scheduleEventRel(final Time.Rel relativeDelay, final short priority, final Object source,
57          final Object target, final String method, final Object[] args) throws SimRuntimeException
58      {
59          super.scheduleEventRel(relativeDelay, priority, source, target, method, args);
60      }
61  
62      /** {@inheritDoc} */
63      @Override
64      public final void scheduleEventRel(final Time.Rel relativeDelay, final Object source, final Object target,
65          final String method, final Object[] args) throws SimRuntimeException
66      {
67          super.scheduleEventRel(relativeDelay, source, target, method, args);
68      }
69  
70      /** {@inheritDoc} */
71      @Override
72      public final void scheduleEventAbs(final Time.Abs absoluteTime, final Object source, final Object target,
73          final String method, final Object[] args) throws SimRuntimeException
74      {
75          super.scheduleEventAbs(absoluteTime, source, target, method, args);
76      }
77  
78      /** {@inheritDoc} */
79      @Override
80      public final void scheduleEventAbs(final Time.Abs absoluteTime, final short priority, final Object source,
81          final Object target, final String method, final Object[] args) throws SimRuntimeException
82      {
83          super.scheduleEventAbs(absoluteTime, priority, source, target, method, args);
84      }
85  
86      /** {@inheritDoc} */
87      @Override
88      public final void runUpTo(final Time.Abs when) throws SimRuntimeException
89      {
90          super.runUpTo(when);
91      }
92  
93      /** {@inheritDoc} */
94      @Override
95      protected final Time.Rel relativeMillis(final double factor)
96      {
97          return new Time.Rel(factor, TimeUnit.MILLISECOND);
98      }
99  
100 }