1 package org.opentrafficsim.simulationengine; 2 3 import java.awt.Rectangle; 4 import java.util.List; 5 6 import javax.naming.NamingException; 7 8 import nl.tudelft.simulation.dsol.SimRuntimeException; 9 10 import org.djunits.value.vdouble.scalar.Duration; 11 import org.djunits.value.vdouble.scalar.Time; 12 import org.opentrafficsim.base.modelproperties.Property; 13 import org.opentrafficsim.base.modelproperties.PropertyException; 14 import org.opentrafficsim.core.network.NetworkException; 15 16 /** 17 * Requirements for demonstration that can be shown in the SuperDemo. 18 * <p> 19 * Copyright (c) 2013-2016 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: 2015-08-23 12:51:29 +0200 (Sun, 23 Aug 2015) $, @version $Revision: 1293 $, 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 WrappableAnimation 27 { 28 /** 29 * Build the animation. 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 List<Property<?>>; the (possibly user-modified) properties. This list must contain all the 35 * properties returned by getProperties(); any additional properties may be ignored 36 * @param rect the x, y, width and height for the window to rebuild. Use null for maximized screen. 37 * @param exitOnClose Use EXIT_ON_CLOSE when true, DISPOSE_ON_CLOSE when false on closing of the window. 38 * @return SimpleSimulation; the new simulation 39 * @throws SimRuntimeException on ??? 40 * @throws NetworkException on Network inconsistency 41 * @throws NamingException when context for the animation cannot be created 42 * @throws OTSSimulationException when the construction of the simulation, the control panel, the animation, or the charts 43 * fails 44 * @throws PropertyException when one of the user modified properties has the empty string as key 45 */ 46 SimpleSimulatorInterface buildAnimator(final Time startTime, final Duration warmupPeriod, final Duration runLength, 47 List<Property<?>> properties, Rectangle rect, boolean exitOnClose) throws SimRuntimeException, NetworkException, 48 NamingException, OTSSimulationException, PropertyException; 49 50 /** 51 * Restart (rebuild) the simulation. 52 * @param rect the x, y, width and height for the window to rebuild. Use null for maximized screen. 53 * @return SimpleSimulation; the new simulation 54 * @throws SimRuntimeException on ??? 55 * @throws NetworkException on Network inconsistency 56 * @throws NamingException when context for the animation cannot be created 57 * @throws OTSSimulationException when the (re)construction of the simulation model fails 58 * @throws PropertyException when one of the user modified properties has the empty string as key 59 */ 60 SimpleSimulatorInterface rebuildSimulator(Rectangle rect) throws SimRuntimeException, NetworkException, NamingException, 61 OTSSimulationException, PropertyException; 62 63 /** 64 * Return a very short description of the simulation. 65 * @return String; short description of the simulation 66 */ 67 String shortName(); 68 69 /** 70 * Return a description of the simulation (HTML formatted). 71 * @return String; HTML text describing the simulation 72 */ 73 String description(); 74 75 /** 76 * Retrieve a list of visible properties of the simulation. <br> 77 * The caller can modify the returned result. If the internal format is also an ArrayList it is highly recommended to make a 78 * protective copy and return that. 79 * @return List<Property<?>>; the list of visible properties 80 */ 81 List<Property<?>> getProperties(); 82 83 /** 84 * Retrieve a list of properties as the user has modified them. 85 * @return ArrayList<Property<?>>; the list of visible properties 86 */ 87 List<Property<?>> getUserModifiedProperties(); 88 89 /** 90 * Stop the timers and threads that are connected when disposing of this wrappable simulation. 91 */ 92 void stopTimersThreads(); 93 }