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

java.lang.Object
nl.tudelft.simulation.dsol.formalisms.flow.Entity<T>
Type Parameters:
T - the time type
All Implemented Interfaces:
Serializable, Identifiable

public class Entity<T extends Number & Comparable<T>> extends Object implements Identifiable, Serializable
Entity is a generic object that can flow through the model. It stores its creation time, so it can tally the 'time in system' when leaving the model.

Copyright (c) 2023-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:
Alexander Verbraeck
See Also:
  • Constructor Details

    • Entity

      public Entity(String id, T creationTime)
      Construct a new Entity with a creation time.
      Parameters:
      id - String; the entity's id
      creationTime - T; the creation time
  • Method Details

    • clone

      public Entity<T> clone()
      Return a clone of the entity. This clone is a literal clone, including the creation time and id.
      Overrides:
      clone in class Object
      Returns:
      Entity<T>; a literal clone of the entity
    • setTimestamp

      public void setTimestamp(String timestampId, T time)
      Add a timestamp to the entity, e.g., to register a tally statistic later.
      Parameters:
      timestampId - String; the id of the timestamp
      time - T; the time to store
    • getTimestamp

      public T getTimestamp(String timestampId)
      Retrieve a stored timestamp.
      Parameters:
      timestampId - String; the id of the timestamp
      Returns:
      T; the creation time
    • setStringValue

      public void setStringValue(String key, String value)
      Add a String as an attribute to the entity.
      Parameters:
      key - String; the key of the attribute
      value - String; the value to store
    • getStringValue

      public String getStringValue(String key)
      Retrieve a stored String attribute value.
      Parameters:
      key - String; the id of the attribute
      Returns:
      String; the stored value
    • setNumberValue

      public void setNumberValue(String key, Number value)
      Add a Number as an attribute to the entity.
      Parameters:
      key - String; the key of the attribute
      value - Number; the value to store
    • getNumberValue

      public Number getNumberValue(String key)
      Retrieve a stored Number attribute value.
      Parameters:
      key - String; the id of the attribute
      Returns:
      Number; the stored value
    • getCreationTime

      public T getCreationTime()
      Return the creation time.
      Returns:
      T; the creation time
    • getId

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

      public String toString()
      Overrides:
      toString in class Object