View Javadoc
1   package org.opentrafficsim.simulationengine;
2   
3   import java.util.ArrayList;
4   
5   import javax.naming.NamingException;
6   
7   import org.djunits.value.vdouble.scalar.Duration;
8   import org.djunits.value.vdouble.scalar.Time;
9   import org.opentrafficsim.base.modelproperties.AbstractProperty;
10  import org.opentrafficsim.base.modelproperties.Property;
11  import org.opentrafficsim.base.modelproperties.PropertyException;
12  import org.opentrafficsim.core.network.NetworkException;
13  
14  import nl.tudelft.simulation.dsol.SimRuntimeException;
15  
16  /**
17   * Requirements for demonstration that can be shown in the SuperDemo.
18   * <p>
19   * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
20   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
21   * <p>
22   * $LastChangedDate: 2018-09-19 13:55:45 +0200 (Wed, 19 Sep 2018) $, @version $Revision: 4006 $, by $Author: averbraeck $,
23   * initial version 17 dec. 2014 <br>
24   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
25   */
26  public interface WrappableSimulation
27  {
28      /**
29       * Build the simulation.
30       * @param startTime Time; the start time of the simulation
31       * @param warmupPeriod Duration; the warm up period of the simulation (use new Duration(0, SECOND) if you don't know what
32       *            this is)
33       * @param runLength Duration; the duration of the simulation
34       * @param properties ArrayList&lt;AbstractProperty&lt;?&gt;&gt;; the (possibly user-modified) properties. This list must
35       *            contain all the properties returned by getProperties(); any additional properties may be ignored
36       * @return SimpleSimulation; the new simulation
37       * @throws SimRuntimeException on ???
38       * @throws NetworkException on Network inconsistency
39       * @throws NamingException when context for the animation cannot be created
40       * @throws OTSSimulationException when the construction of the simulation, the control panel, the animation, or the charts
41       *             fails
42       * @throws PropertyException when one of the user modified properties has the empty string as key
43       */
44      SimpleSimulatorInterface buildSimulator(Time startTime, Duration warmupPeriod, Duration runLength,
45              ArrayList<Property<?>> properties)
46              throws SimRuntimeException, NetworkException, NamingException, OTSSimulationException, PropertyException;
47  
48      /**
49       * Return a very short description of the simulation.
50       * @return String; short description of the simulation
51       */
52      String shortName();
53  
54      /**
55       * Return a description of the simulation (HTML formatted).
56       * @return String; HTML text describing the simulation
57       */
58      String description();
59  
60      /**
61       * Retrieve a list of visible properties of the simulation. <br>
62       * The caller can modify the returned result. If the internal format is also an ArrayList it is highly recommended to make a
63       * protective copy and return that.
64       * @return ArrayList&lt;AbstractProperty&lt;?&gt;&gt;; the list of visible properties
65       */
66      ArrayList<AbstractProperty<?>> getProperties();
67  
68      /**
69       * Set the number of the next spawned replication.
70       * @param nextReplication Integer; the next replication number, or null to use the built-in auto-incrementing replication
71       *            counter
72       */
73      void setNextReplication(Integer nextReplication);
74  
75  }