OTSDEVSAnimator.java

  1. package org.opentrafficsim.core.dsol;

  2. import java.rmi.RemoteException;

  3. import org.djunits.value.vdouble.scalar.Duration;
  4. import org.djunits.value.vdouble.scalar.Time;

  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.DEVSAnimator;

  9. /**
  10.  * <p>
  11.  * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  12.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  13.  * <p>
  14.  * @version $Revision: 2386 $, $LastChangedDate: 2016-10-16 14:55:54 +0200 (Sun, 16 Oct 2016) $, by $Author: averbraeck $,
  15.  *          initial version Aug 15, 2014 <br>
  16.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  17.  */
  18. public class OTSDEVSAnimator extends DEVSAnimator<Time, Duration, OTSSimTimeDouble>
  19.         implements OTSDEVSSimulatorInterface, OTSAnimatorInterface
  20. {
  21.     /** */
  22.     private static final long serialVersionUID = 20140909L;

  23.     /**
  24.      * Create a new OTSDEVSAnimator..
  25.      */
  26.     public OTSDEVSAnimator()
  27.     {
  28.         super();
  29.     }

  30.     /** {@inheritDoc} */
  31.     @Override
  32.     public final void initialize(final Replication<Time, Duration, OTSSimTimeDouble> initReplication,
  33.             final ReplicationMode replicationMode) throws SimRuntimeException
  34.     {
  35.         try
  36.         {
  37.             super.initialize(initReplication, replicationMode);
  38.         }
  39.         catch (RemoteException exception)
  40.         {
  41.             throw new SimRuntimeException(exception);
  42.         }
  43.     }

  44.     /** {@inheritDoc} */
  45.     @Override
  46.     public final void runUpTo(final Time when) throws SimRuntimeException
  47.     {
  48.         super.runUpTo(when);
  49.     }

  50.     /** {@inheritDoc} */
  51.     @Override
  52.     public final String toString()
  53.     {
  54.         return "OTSDEVSAnimator [time=" + getSimulatorTime().getTime() + "]";
  55.     }

  56. }