1 package org.opentrafficsim.simulationengine; 2 3 import java.awt.Rectangle; 4 import java.util.ArrayList; 5 6 import javax.naming.NamingException; 7 8 import nl.tudelft.simulation.dsol.SimRuntimeException; 9 10 import org.djunits.value.vdouble.scalar.Time; 11 import org.opentrafficsim.core.network.NetworkException; 12 import org.opentrafficsim.simulationengine.properties.AbstractProperty; 13 14 /** 15 * Requirements for demonstration that can be shown in the SuperDemo. 16 * <p> 17 * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 18 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>. 19 * <p> 20 * $LastChangedDate: 2015-08-23 12:51:29 +0200 (Sun, 23 Aug 2015) $, @version $Revision: 1293 $, by $Author: averbraeck $, 21 * initial version 17 dec. 2014 <br> 22 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a> 23 */ 24 public interface WrappableAnimation 25 { 26 /** 27 * Build the animation. 28 * @param startTime Time.Abs; the start time of the simulation 29 * @param warmupPeriod Time.Rel; the warm up period of the simulation (use new Time.Rel(0, SECOND) if you don't know what 30 * this is) 31 * @param runLength Time.Rel; the duration of the simulation 32 * @param properties ArrayList<AbstractProperty<?>>; the (possibly user-modified) properties. This list must 33 * contain all the properties returned by getProperties(); any additional properties may be ignored 34 * @param rect the x, y, width and height for the window to rebuild. Use null for maximized screen. 35 * @param exitOnClose Use EXIT_ON_CLOSE when true, DISPOSE_ON_CLOSE when false on closing of the window. 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 */ 43 SimpleSimulatorInterface buildAnimator(final Time.Abs startTime, final Time.Rel warmupPeriod, 44 final Time.Rel runLength, ArrayList<AbstractProperty<?>> properties, Rectangle rect, boolean exitOnClose) 45 throws SimRuntimeException, NetworkException, NamingException, OTSSimulationException; 46 47 /** 48 * Restart (rebuild) the simulation. 49 * @param rect the x, y, width and height for the window to rebuild. Use null for maximized screen. 50 * @return SimpleSimulation; the new simulation 51 * @throws SimRuntimeException on ??? 52 * @throws NetworkException on Network inconsistency 53 * @throws NamingException when context for the animation cannot be created 54 * @throws OTSSimulationException when the (re)construction of the simulation model fails 55 */ 56 SimpleSimulatorInterface rebuildSimulator(Rectangle rect) throws SimRuntimeException, NetworkException, 57 NamingException, OTSSimulationException; 58 59 /** 60 * Return a very short description of the simulation. 61 * @return String; short description of the simulation 62 */ 63 String shortName(); 64 65 /** 66 * Return a description of the simulation (HTML formatted). 67 * @return String; HTML text describing the simulation 68 */ 69 String description(); 70 71 /** 72 * Retrieve a list of visible properties of the simulation. <br> 73 * The caller can modify the returned result. If the internal format is also an ArrayList it is highly recommended to make a 74 * protective copy and return that. 75 * @return ArrayList<AbstractProperty<?>>; the list of visible properties 76 */ 77 ArrayList<AbstractProperty<?>> getProperties(); 78 79 /** 80 * Retrieve a list of properties as the user has modified them. 81 * @return ArrayList<AbstractProperty<?>>; the list of visible properties 82 */ 83 ArrayList<AbstractProperty<?>> getUserModifiedProperties(); 84 85 /** 86 * Stop the timers and threads that are connected when disposing of this wrappable simulation. 87 */ 88 void stopTimersThreads(); 89 }