AbstractOTSModel.java

  1. package org.opentrafficsim.core.dsol;

  2. import nl.tudelft.simulation.dsol.model.AbstractDSOLModel;

  3. /**
  4.  * AbstractOTSModel is the base class for a model that runs on an OTSSimulator. <br>
  5.  * <br>
  6.  * Copyright (c) 2003-2019 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
  7.  * for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>. The
  8.  * source code and binary code of this software is proprietary information of Delft University of Technology.
  9.  * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
  10.  */
  11. public abstract class AbstractOTSModel extends AbstractDSOLModel.TimeDoubleUnit<OTSSimulatorInterface>
  12.         implements OTSModelInterface
  13. {
  14.     /** */
  15.     private static final long serialVersionUID = 1L;

  16.     /** a very short description of the simulation. */
  17.     private String shortName;

  18.     /** a description of the simulation (HTML formatted). */
  19.     private String description;

  20.     /**
  21.      * Instantiate an abstract OTSModel.
  22.      * @param simulator OTSSimulatorInterface; the simulator to use
  23.      * @param shortName String; a very short description of the simulation
  24.      * @param description String; a description of the simulation (HTML formatted)
  25.      */
  26.     public AbstractOTSModel(final OTSSimulatorInterface simulator, final String shortName, final String description)
  27.     {
  28.         super(simulator);
  29.         this.shortName = shortName;
  30.         this.description = description;
  31.     }

  32.     /**
  33.      * Instantiate an abstract OTSModel. The name and description will be set as the class name.
  34.      * @param simulator OTSSimulatorInterface; the simulator to use
  35.      */
  36.     public AbstractOTSModel(final OTSSimulatorInterface simulator)
  37.     {
  38.         super(simulator);
  39.         this.shortName = getClass().getSimpleName();
  40.         this.description = getClass().getSimpleName();
  41.     }

  42.     /** {@inheritDoc} */
  43.     @Override
  44.     public final String getShortName()
  45.     {
  46.         return this.shortName;
  47.     }

  48.     /**
  49.      * @param shortName String; set shortName
  50.      */
  51.     public final void setShortName(final String shortName)
  52.     {
  53.         this.shortName = shortName;
  54.     }

  55.     /** {@inheritDoc} */
  56.     @Override
  57.     public final String getDescription()
  58.     {
  59.         return this.description;
  60.     }

  61.     /**
  62.      * @param description String; set description
  63.      */
  64.     public final void setDescription(final String description)
  65.     {
  66.         this.description = description;
  67.     }

  68. }