Class 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.AbstractSimEntityDelegator
    This is the abstract base class for all simulated entities. Entities have an ID and they notify registered IEntityListeners 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 ClassA can have a certain ID while at the same time an entity of ClassB can 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 calling notifyEnteredSystem() or notifyLeftSystem().

    • Field Summary

      • Fields inherited from class de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimEntityDelegator

        delegate
      • Fields inherited from interface de.uka.ipd.sdq.simulation.abstractsimengine.IEntity

        NULL
    • Constructor Summary

      Constructors 
      Constructor Description
      EventSimEntity​(de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationModel simulationModel, String namePrefix)
      Constructs an entity with the specified namePrefix.
    • Constructor Detail

      • EventSimEntity

        public EventSimEntity​(de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationModel simulationModel,
                              String namePrefix)
        Constructs an entity with the specified namePrefix. The entity is created with an ID that is unique with regard to the entity's class.
        Parameters:
        model - the model
        namePrefix - the prefix of the entitie's name
    • Method Detail

      • notifyEnteredSystem

        public void notifyEnteredSystem()
        Notifies all registered listeners as well as the EventSimModel that the entity is about to enter the system.
      • notifyLeftSystem

        public void notifyLeftSystem()
        Notifies all registered listeners as well as the EventSimModel that 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 the namePrefix passed to the constructor concatenated with the entity's ID.
        Overrides:
        getName in class de.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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object