Class CloudSimEvent

java.lang.Object
org.cloudbus.cloudsim.core.events.CloudSimEvent
All Implemented Interfaces:
Comparable<SimEvent>, SimEvent, EventInfo

public final class CloudSimEvent extends Object implements SimEvent
An event which is passed between the entities in the simulation.
Author:
Costas Simatos
See Also:
  • Constructor Details

    • CloudSimEvent

      public CloudSimEvent(double delay, SimEntity src, SimEntity dest, CloudSimTag tag, Object data)
      Creates a SimEvent.Type.SEND CloudSimEvent.
      Parameters:
      delay - how many seconds after the current simulation time the event should be scheduled
      src - the source entity which is sending the message
      dest - the destination entity which has to receive the message
      tag - the tag that identifies the type of the message (which is used by the destination entity to perform operations based on the message type)
      data - the data attached to the message, that depends on the message tag
    • CloudSimEvent

      public CloudSimEvent(double delay, SimEntity dest, CloudSimTag tag)
      Creates a SimEvent.Type.SEND CloudSimEvent where the sender and destination are the same entity.
      Parameters:
      delay - how many seconds after the current simulation time the event should be scheduled
      dest - the destination entity which has to receive the message
      tag - the tag that identifies the type of the message (which is used by the destination entity to perform operations based on the message type)
    • CloudSimEvent

      public CloudSimEvent(SimEntity dest, CloudSimTag tag, Object data)
      Creates a SimEvent.Type.SEND CloudSimEvent where the sender and destination are the same entity and the message is sent with no delay.
      Parameters:
      dest - the destination entity which has to receive the message
      tag - the tag that identifies the type of the message (which is used by the destination entity to perform operations based on the message type)
      data - the data attached to the message, that depends on the message tag
    • CloudSimEvent

      public CloudSimEvent(double delay, SimEntity dest, CloudSimTag tag, Object data)
      Creates a SimEvent.Type.SEND CloudSimEvent where the sender and destination are the same entity.
      Parameters:
      delay - how many seconds after the current simulation time the event should be scheduled
      dest - the destination entity which has to receive the message
      tag - the tag that identifies the type of the message (which is used by the destination entity to perform operations based on the message type)
      data - the data attached to the message, that depends on the message tag
    • CloudSimEvent

      public CloudSimEvent(SimEntity dest, CloudSimTag tag)
      Creates a SimEvent.Type.SEND CloudSimEvent where the sender and destination are the same entity, the message has no delay and no data.
      Parameters:
      dest - the source entity which has to receive the message
      tag - the tag that identifies the type of the message (which is used by the destination entity to perform operations based on the message type)
    • CloudSimEvent

      public CloudSimEvent(SimEvent.Type type, double delay, SimEntity src)
      Creates a CloudSimEvent where the destination entity and tag are not set yet. Furthermore, there will be not data associated to the event.
      Parameters:
      delay - how many seconds after the current simulation time the event should be scheduled
    • CloudSimEvent

      public CloudSimEvent(SimEvent src)
      Creates a CloudSimEvent cloning another given one.
      Parameters:
      src - the event to clone
    • CloudSimEvent

      public CloudSimEvent(SimEvent.Type type, double delay, SimEntity src, SimEntity dest, CloudSimTag tag, Object data)
      Creates a CloudSimEvent.
      Parameters:
      type - the internal type of the event
      delay - how many seconds after the current simulation time the event should be scheduled
      src - the source entity which is sending the message
      dest - the destination entity which has to receive the message
      tag - the tag that identifies the type of the message (which is used by the destination entity to perform operations based on the message type)
      data - the data attached to the message, that depends on the message tag
  • Method Details

    • setSerial

      public void setSerial(long serial)
      Description copied from interface: SimEvent
      Sets the serial number that defines the order of received events when multiple events are generated at the same time.
      Specified by:
      setSerial in interface SimEvent
      Parameters:
      serial - the serial value to set
    • getEndWaitingTime

      public double getEndWaitingTime()
      Description copied from interface: SimEvent
      Gets the simulation time that this event was removed from the queue for service.
      Specified by:
      getEndWaitingTime in interface SimEvent
      Returns:
    • setSimulation

      public SimEvent setSimulation(Simulation simulation)
      Description copied from interface: SimEvent
      Sets the simulation the event belongs to
      Specified by:
      setSimulation in interface SimEvent
      Parameters:
      simulation - the simulation instance to set
      Returns:
    • getType

      public SimEvent.Type getType()
      Description copied from interface: SimEvent
      Gets the internal type
      Specified by:
      getType in interface SimEvent
      Returns:
    • compareTo

      public int compareTo(SimEvent that)
      Specified by:
      compareTo in interface Comparable<SimEvent>
      Specified by:
      compareTo in interface SimEvent
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getDestination

      public SimEntity getDestination()
      Description copied from interface: SimEvent
      Gets the entity which received this event.
      Specified by:
      getDestination in interface SimEvent
      Returns:
    • getSource

      public SimEntity getSource()
      Description copied from interface: SimEvent
      Gets the entity which scheduled this event.
      Specified by:
      getSource in interface SimEvent
      Returns:
    • getTag

      public CloudSimTag getTag()
      Description copied from interface: SimEvent
      Gets the tag that classifies this event. The meaning of such a tag depends on the entities that generate and receive the event. Usually it is defined from a constant value defined in CloudSimTag.
      Specified by:
      getTag in interface SimEvent
      Returns:
    • getPriority

      public int getPriority()
      Description copied from interface: SimEvent
      Gets the priority of this event. Negative values indicates higher priority.
      Specified by:
      getPriority in interface SimEvent
      Returns:
    • getData

      public Object getData()
      Description copied from interface: SimEvent
      Gets the data object passed in this event. The actual class of this data is defined by the entity that generates the event. The value defined for the SimEvent.getTag() is used by an entity receiving the event to know what is the class of the data associated to the event. After checking what is the event tag, te destination entity can perform a typecast to convert the data to the expected class.
      Specified by:
      getData in interface SimEvent
      Returns:
      a reference to the data object
    • setSource

      public SimEvent setSource(SimEntity source)
      Description copied from interface: SimEvent
      Sets the source entity of this event, that defines its sender.
      Specified by:
      setSource in interface SimEvent
      Parameters:
      source - the unique id number of the source entity
      Returns:
    • setDestination

      public SimEvent setDestination(SimEntity destination)
      Description copied from interface: SimEvent
      Sets the destination entity of this event, that defines its destination.
      Specified by:
      setDestination in interface SimEvent
      Parameters:
      destination - the unique id number of the destination entity
      Returns:
    • getTime

      public double getTime()
      Description copied from interface: EventInfo
      Gets the time the event happened.
      Specified by:
      getTime in interface EventInfo
      Returns:
    • getListener

      public EventListener<? extends EventInfo> getListener()
      Description copied from interface: EventInfo
      Gets the listener that was notified about the event.
      Specified by:
      getListener in interface EventInfo
      Returns:
    • getSerial

      public long getSerial()
      Description copied from interface: SimEvent
      Gets the serial number that defines the order of received events when multiple events are generated at the same time. If two events have the same SimEvent.getTag(), to know what event is greater than other (i.e. that happens after other), the SimEvent.compareTo(SimEvent) makes use of this field.
      Specified by:
      getSerial in interface SimEvent
      Returns:
    • getSimulation

      public Simulation getSimulation()
      Description copied from interface: SimEvent
      Gets the CloudSim instance that represents the simulation for with the Entity is related to.
      Specified by:
      getSimulation in interface SimEvent
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object