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

java.lang.Object
org.djutils.event.LocalEventProducer
nl.tudelft.simulation.dsol.formalisms.flow.FlowObject<T>
Type Parameters:
T - the time type
All Implemented Interfaces:
Serializable, Remote, Identifiable, EventProducer
Direct Known Subclasses:
Create, Delay, Destroy, Duplicate, Release, Seize

public abstract class FlowObject<T extends Number & Comparable<T>> extends LocalEventProducer implements Identifiable
A FlowObject that can receive and/or release Entity objects.

Copyright (c) 2002-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.

Author:
Peter Jacobs , Alexander Verbraeck
See Also:
  • Field Details

    • RECEIVE_EVENT

      public static final EventType RECEIVE_EVENT
      RECEIVE_EVENT is fired whenever an entity enters the flow object.
    • RELEASE_EVENT

      public static final EventType RELEASE_EVENT
      RELEASE_EVENT is fired whenever an entity leaves the flow object.
  • Constructor Details

    • FlowObject

      public FlowObject(String id, DevsSimulatorInterface<T> simulator)
      Construct a new FlowObject.
      Parameters:
      id - String; the id of the FlowObject
      simulator - DevsSimulatorInterface<T>; is the simulator on which behavior is scheduled
  • Method Details

    • receiveEntity

      public void receiveEntity(Entity<T> entity)
      Arrival of a new entity into the flow object.
      Parameters:
      entity - Entity; the arriving entity
    • setDestination

      public void setDestination(FlowObject<T> destination)
      Set the destination of this flow object. The destination is the object the entity will go to when leaving this flow object.
      Parameters:
      destination - FlowObject<T>; the next flow object in the model
    • releaseEntity

      protected void releaseEntity(Entity<T> entity)
      Release an entity, making it flow to the next flow object (the destination) when destination is not null. When destination is null, the entity will be discarded.
      Parameters:
      entity - Entity; the entity to release
    • getDestination

      public FlowObject<T> getDestination()
      Return the current destination.
      Returns:
      FlowObject; the destination of this flow object
    • getSimulator

      public DevsSimulatorInterface<T> getSimulator()
      Return the simulator.
      Returns:
      DevsSimultorInterface<T>; the simulator
    • getId

      public String getId()
      Specified by:
      getId in interface Identifiable
    • toString

      public String toString()
      Overrides:
      toString in class Object