Class EventSimEntity
- java.lang.Object
-
- de.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement
-
- de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator
-
- edu.kit.ipd.sdq.eventsim.entities.EventSimEntity
-
- All Implemented Interfaces:
de.uka.ipd.sdq.simulation.abstractsimengine.IEntity
- Direct Known Subclasses:
AbstractActiveResource,Request,SimPassiveResource,SimulatedProcess,User
public abstract class EventSimEntity extends de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegatorThis is the abstract base class for all simulated entities. Entities have an ID and they notify registeredIEntityListeners if requested. Both, the generation of IDs and the handling of listeners is provided by this class.IDs are unique with regard to the class of an entity. Thus, an entity that is an instance of
ClassAcan have a certain ID while at the same time an entity ofClassBcan have the same ID. IDs are generated as follows: 0, 1, ..., n.Listeners can register themselves by using the
addEntityListener()method. The listeners can be notified by callingnotifyEnteredSystem()ornotifyLeftSystem().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEventSimEntity.EntityLifecyclePhaseThe lifecycle phase of an entity.
-
Constructor Summary
Constructors Constructor Description EventSimEntity(de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationModel simulationModel, String namePrefix)Constructs an entity with the specifiednamePrefix.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEntityListener(IEntityListener listener)Adds a listener, which is to be informed whenever an entity is about to enter or has left the system.booleanequals(Object obj)longgetEntityId()EventSimEntity.EntityLifecyclePhasegetLifecyclePhase()Returns the current lifecycle phase of this entity.StringgetName()Returns the name of this entity.inthashCode()voidnotifyEnteredSystem()Notifies all registered listeners as well as theEventSimModelthat the entity is about to enter the system.voidnotifyLeftSystem()Notifies all registered listeners as well as theEventSimModelthat the entity has left the system.voidremoveEntityListener(IEntityListener listener)Removes a listener that has been registered before.static voidresetIdGenerator()Resets the ID generators, so that the ID generated next is 0 for all entity classes.StringtoString()
-
-
-
Constructor Detail
-
EventSimEntity
public EventSimEntity(de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationModel simulationModel, String namePrefix)Constructs an entity with the specifiednamePrefix. The entity is created with an ID that is unique with regard to the entity's class.- Parameters:
model- the modelnamePrefix- the prefix of the entitie's name
-
-
Method Detail
-
notifyEnteredSystem
public void notifyEnteredSystem()
Notifies all registered listeners as well as theEventSimModelthat the entity is about to enter the system.
-
notifyLeftSystem
public void notifyLeftSystem()
Notifies all registered listeners as well as theEventSimModelthat the entity has left the system.
-
addEntityListener
public void addEntityListener(IEntityListener listener)
Adds a listener, which is to be informed whenever an entity is about to enter or has left the system.- Parameters:
listener- the listener that is to be added
-
removeEntityListener
public void removeEntityListener(IEntityListener listener)
Removes a listener that has been registered before.- Parameters:
listener- the listener that is to be removed
-
getEntityId
public long getEntityId()
-
getName
public String getName()
Returns the name of this entity. The name is thenamePrefixpassed to the constructor concatenated with the entity's ID.- Overrides:
getNamein classde.uka.ipd.sdq.simulation.abstractsimengine.SimulationElement- Returns:
- a string representation of this entity
-
resetIdGenerator
public static void resetIdGenerator()
Resets the ID generators, so that the ID generated next is 0 for all entity classes.
-
getLifecyclePhase
public EventSimEntity.EntityLifecyclePhase getLifecyclePhase()
Returns the current lifecycle phase of this entity.- See Also:
EventSimEntity.EntityLifecyclePhase
-
-