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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Return a clone of the entity.Return the creation time.getId()
getNumberValue
(String key) Retrieve a stored Number attribute value.getStringValue
(String key) Retrieve a stored String attribute value.getTimestamp
(String timestampId) Retrieve a stored timestamp.void
setNumberValue
(String key, Number value) Add a Number as an attribute to the entity.void
setStringValue
(String key, String value) Add a String as an attribute to the entity.void
setTimestamp
(String timestampId, T time) Add a timestamp to the entity, e.g., to register a tally statistic later.toString()
-
Constructor Details
-
Entity
Construct a new Entity with a creation time.- Parameters:
id
- String; the entity's idcreationTime
- T; the creation time
-
-
Method Details
-
clone
Return a clone of the entity. This clone is a literal clone, including the creation time and id. -
setTimestamp
Add a timestamp to the entity, e.g., to register a tally statistic later.- Parameters:
timestampId
- String; the id of the timestamptime
- T; the time to store
-
getTimestamp
Retrieve a stored timestamp.- Parameters:
timestampId
- String; the id of the timestamp- Returns:
- T; the creation time
-
setStringValue
Add a String as an attribute to the entity.- Parameters:
key
- String; the key of the attributevalue
- String; the value to store
-
getStringValue
Retrieve a stored String attribute value.- Parameters:
key
- String; the id of the attribute- Returns:
- String; the stored value
-
setNumberValue
Add a Number as an attribute to the entity.- Parameters:
key
- String; the key of the attributevalue
- Number; the value to store
-
getNumberValue
Retrieve a stored Number attribute value.- Parameters:
key
- String; the id of the attribute- Returns:
- Number; the stored value
-
getCreationTime
Return the creation time.- Returns:
- T; the creation time
-
getId
- Specified by:
getId
in interfaceIdentifiable
-
toString
-