Class AbstractDevsPortModel<T extends Number & Comparable<T>>

java.lang.Object
org.djutils.event.LocalEventProducer
nl.tudelft.simulation.dsol.formalisms.devs.esdevs.AbstractDevsModel<T>
nl.tudelft.simulation.dsol.formalisms.devs.esdevs.AbstractDevsPortModel<T>
Type Parameters:
T - the time type
All Implemented Interfaces:
Serializable, Remote, org.djutils.event.EventProducer
Direct Known Subclasses:
AtomicModel, CoupledModel

public abstract class AbstractDevsPortModel<T extends Number & Comparable<T>> extends AbstractDevsModel<T>
AbstractDevsPortModel class. Adds named ports to the abstract DEVS model.

Copyright (c) 2009-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.

Since:
1.5
Author:
Mamadou Seck
, Alexander Verbraeck
See Also:
  • Field Details

  • Constructor Details

    • AbstractDevsPortModel

      public AbstractDevsPortModel(String modelName, DevsSimulatorInterface<T> simulator, CoupledModel<T> parentModel)
      Constructor for an abstract DEVS model with ports: we have to indicate the simulator to schedule the events on, and the parent model we are part of. A parent model of null means that we are the top model.
      Parameters:
      modelName - String; the name of this component
      simulator - DevsSimulatorInterface<T>; the simulator to schedule the events on.
      parentModel - CoupledModel<T>; the parent model we are part of.
  • Method Details

    • addInputPort

      protected <TYPE> void addInputPort(String name, InputPortInterface<T,TYPE> inputPort) throws PortAlreadyDefinedException
      Add an input port to the model. Use a name to be able to identify the port later.
      Type Parameters:
      TYPE - the type of variable of the input port
      Parameters:
      name - String; the (unique) name of the input port
      inputPort - InputPortInterface<T,TYPE>; the input port to add
      Throws:
      PortAlreadyDefinedException - in case the port name already exist for the model
    • addOutputPort

      protected <TYPE> void addOutputPort(String name, OutputPortInterface<T,TYPE> outputPort) throws PortAlreadyDefinedException
      Add an output port to the model. Use a name to be able to identify the port later.
      Type Parameters:
      TYPE - the type of variable of the output port
      Parameters:
      name - String; the (unique) name of the output port
      outputPort - OutputPortInterface<T,TYPE>; the output port to add
      Throws:
      PortAlreadyDefinedException - in case the port name already exist for the model
    • removeInputPort

      protected void removeInputPort(String name) throws PortNotFoundException
      Remove an input port from the model. Note: override this method in classes that extend the behavior, e.g. to remove couplings from this port in case it is removed.
      Parameters:
      name - String; the name of the input port to be removed
      Throws:
      PortNotFoundException - in case the port name does not exist for the model
    • removeOutputPort

      protected void removeOutputPort(String name) throws PortNotFoundException
      Remove an output port from the model. Note: override this method in classes that extend the behavior, e.g. to remove couplings from this port in case it is removed.
      Parameters:
      name - String; the name of the output port to be removed
      Throws:
      PortNotFoundException - in case the port name does not exist for the model
    • getInputPortMap

      public Map<String,InputPortInterface<T,?>> getInputPortMap()
      Returns:
      inputPortMap; the map of input port names to input ports.
    • getOutputPortMap

      public Map<String,OutputPortInterface<T,?>> getOutputPortMap()
      Returns:
      outputPortMap; the map of output port names to output ports