1 package org.opentrafficsim.simulationengine; 2 3 import java.awt.Rectangle; 4 import java.rmi.RemoteException; 5 import java.util.ArrayList; 6 7 import javax.naming.NamingException; 8 9 import nl.tudelft.simulation.dsol.SimRuntimeException; 10 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 WrappableSimulation 25 { 26 /** 27 * Build the simulation. 28 * @param properties ArrayList<AbstractProperty<?>>; the (possibly user-modified) properties. This list must 29 * contain all the properties returned by getProperties(); any additional properties may be ignored 30 * @param rect the x, y, width and height for the window to rebuild. Use null for maximized screen. 31 * @param exitOnClose Use EXIT_ON_CLOSE when true, DISPOSE_ON_CLOSE when false on closing of the window. 32 * @return SimpleSimulation; the new simulation 33 * @throws RemoteException on communications failure 34 * @throws SimRuntimeException on ??? 35 * @throws NetworkException on Network inconsistency 36 * @throws NamingException when context for the animation cannot be created 37 */ 38 SimpleSimulation buildSimulator(ArrayList<AbstractProperty<?>> properties, Rectangle rect, boolean exitOnClose) 39 throws SimRuntimeException, RemoteException, NetworkException, NamingException; 40 41 /** 42 * Return a very short description of the simulation. 43 * @return String; short description of the simulation 44 */ 45 String shortName(); 46 47 /** 48 * Return a description of the simulation (HTML formatted). 49 * @return String; HTML text describing the simulation 50 */ 51 String description(); 52 53 /** 54 * Restart (rebuild) the simulation. 55 * @param rect the x, y, width and height for the window to rebuild. Use null for maximized screen. 56 * @return SimpleSimulation; the new simulation 57 * @throws RemoteException on communications failure 58 * @throws SimRuntimeException on ??? 59 * @throws NetworkException on Network inconsistency 60 * @throws NamingException when context for the animation cannot be created 61 */ 62 SimpleSimulation rebuildSimulator(Rectangle rect) throws SimRuntimeException, RemoteException, NetworkException, 63 NamingException; 64 65 /** 66 * Retrieve a list of visible properties of the simulation. <br> 67 * The caller can modify the returned result. If the internal format is also an ArrayList it is highly recommended to make a 68 * protective copy and return that. 69 * @return ArrayList<AbstractProperty<?>>; the list of visible properties 70 */ 71 ArrayList<AbstractProperty<?>> getProperties(); 72 73 /** 74 * Retrieve a list of properties as the user has modified them. 75 * @return ArrayList<AbstractProperty<?>>; the list of visible properties 76 */ 77 ArrayList<AbstractProperty<?>> getUserModifiedProperties(); 78 79 /** 80 * Stop the timers and threads that are connected when disposing of this wrappable simulation. 81 */ 82 void stopTimersThreads(); 83 }