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.DOUBLE_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 DoubleScalar.Abs<TimeUnit>; the start time of the simulation 29 * @param warmupPeriod DoubleScalar.Rel<TimeUnit>; the warm up period of the simulation (use new 30 * DoubleScalar.Rel<TimeUnit>(0, SECOND) if you don't know what this is) 31 * @param runLength DoubleScalar.Rel<TimeUnit>; 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 */ 41 SimpleSimulatorInterface buildAnimator(final Time.Abs startTime, final Time.Rel warmupPeriod, final Time.Rel runLength, 42 ArrayList<AbstractProperty<?>> properties, Rectangle rect, boolean exitOnClose) throws SimRuntimeException, 43 NetworkException, NamingException; 44 45 /** 46 * Restart (rebuild) the simulation. 47 * @param rect the x, y, width and height for the window to rebuild. Use null for maximized screen. 48 * @return SimpleSimulation; the new simulation 49 * @throws SimRuntimeException on ??? 50 * @throws NetworkException on Network inconsistency 51 * @throws NamingException when context for the animation cannot be created 52 */ 53 SimpleSimulatorInterface rebuildSimulator(Rectangle rect) throws SimRuntimeException, NetworkException, 54 NamingException; 55 56 /** 57 * Return a very short description of the simulation. 58 * @return String; short description of the simulation 59 */ 60 String shortName(); 61 62 /** 63 * Return a description of the simulation (HTML formatted). 64 * @return String; HTML text describing the simulation 65 */ 66 String description(); 67 68 /** 69 * Retrieve a list of visible properties of the simulation. <br> 70 * The caller can modify the returned result. If the internal format is also an ArrayList it is highly recommended to make a 71 * protective copy and return that. 72 * @return ArrayList<AbstractProperty<?>>; the list of visible properties 73 */ 74 ArrayList<AbstractProperty<?>> getProperties(); 75 76 /** 77 * Retrieve a list of properties as the user has modified them. 78 * @return ArrayList<AbstractProperty<?>>; the list of visible properties 79 */ 80 ArrayList<AbstractProperty<?>> getUserModifiedProperties(); 81 82 /** 83 * Stop the timers and threads that are connected when disposing of this wrappable simulation. 84 */ 85 void stopTimersThreads(); 86 }