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
This class represents a simulation event which is passed between the entities
in the simulation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.core.events.SimEvent
SimEvent.Type
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CloudSimEvent(double delay, SimEntity dest, int tag)
Creates aSimEvent.Type.SEND
CloudSimEvent where the sender and destination are the same entity.CloudSimEvent(double delay, SimEntity dest, int tag, Object data)
Creates aSimEvent.Type.SEND
CloudSimEvent where the sender and destination are the same entity.CloudSimEvent(double delay, SimEntity src, SimEntity dest, int tag, Object data)
Creates aSimEvent.Type.SEND
CloudSimEvent.CloudSimEvent(SimEvent src)
Creates a CloudSimEvent cloning another given one.CloudSimEvent(SimEvent.Type type, double delay, SimEntity src)
Creates a CloudSimEvent where the destination entity and tag are not set yet.CloudSimEvent(SimEvent.Type type, double delay, SimEntity src, SimEntity dest, int tag, Object data)
Creates a CloudSimEvent.CloudSimEvent(SimEntity dest, int tag)
Creates aSimEvent.Type.SEND
CloudSimEvent where the sender and destination are the same entity, the message has no delay and no data.CloudSimEvent(SimEntity dest, int tag, Object data)
Creates aSimEvent.Type.SEND
CloudSimEvent where the sender and destination are the same entity and the message is sent with no delay. -
Method Summary
Modifier and Type Method Description int
compareTo(SimEvent evt)
boolean
equals(Object o)
Object
getData()
Gets the data object passed in this event.SimEntity
getDestination()
Gets the entity which received this event.double
getEndWaitingTime()
Gets the simulation time that this event was removed from the queue for service.EventListener<? extends EventInfo>
getListener()
Gets the listener that was notified about the event.long
getSerial()
Gets the serial number that defines the order of received events when multiple events are generated at the same time.Simulation
getSimulation()
Gets the CloudSim instance that represents the simulation for with the Entity is related to.SimEntity
getSource()
Gets the entity which scheduled this event.int
getTag()
Gets the user-defined tag of this event.double
getTime()
Gets the time the event happened.SimEvent.Type
getType()
Gets the internal typeint
hashCode()
SimEntity
scheduledBy()
Gets the entity which scheduled this event.SimEvent
setDestination(SimEntity destination)
Sets the destination entity of this event, that defines its destination.void
setSerial(long serial)
Sets the serial number that defines the order of received events when multiple events are generated at the same time.SimEvent
setSimulation(Simulation simulation)
Sets the simulation the event belongs toSimEvent
setSource(SimEntity source)
Sets the source entity of this event, that defines its sender.String
toString()
-
Constructor Details
-
CloudSimEvent
Creates aSimEvent.Type.SEND
CloudSimEvent.- Parameters:
delay
- how many seconds after the current simulation time the event should be scheduledsrc
- the source entity which is sending the messagedest
- the destination entity which has to receive the messagetag
- 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
Creates aSimEvent.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 scheduleddest
- the destination entity which has to receive the messagetag
- 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
Creates aSimEvent.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 messagetag
- 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
Creates aSimEvent.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 scheduleddest
- the destination entity which has to receive the messagetag
- 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
Creates aSimEvent.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 messagetag
- 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
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
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, int tag, Object data)Creates a CloudSimEvent.- Parameters:
type
- the internal type of the eventdelay
- how many seconds after the current simulation time the event should be scheduledsrc
- the source entity which is sending the messagedest
- the destination entity which has to receive the messagetag
- 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. -
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 interfaceSimEvent
- Returns:
-
setSimulation
Description copied from interface:SimEvent
Sets the simulation the event belongs to- Specified by:
setSimulation
in interfaceSimEvent
- Parameters:
simulation
- the simulation instance to set- Returns:
-
getType
Description copied from interface:SimEvent
Gets the internal type -
compareTo
- Specified by:
compareTo
in interfaceComparable<SimEvent>
- Specified by:
compareTo
in interfaceSimEvent
-
equals
-
hashCode
public int hashCode() -
getDestination
Description copied from interface:SimEvent
Gets the entity which received this event.- Specified by:
getDestination
in interfaceSimEvent
- Returns:
-
getSource
Description copied from interface:SimEvent
Gets the entity which scheduled this event. -
scheduledBy
Description copied from interface:SimEvent
Gets the entity which scheduled this event.- Specified by:
scheduledBy
in interfaceSimEvent
- Returns:
-
getTag
public int getTag()Description copied from interface:SimEvent
Gets the user-defined tag of 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 inCloudSimTags
. -
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 theSimEvent.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 then can perform a typecast to convert the data to the expected class. -
setSource
Description copied from interface:SimEvent
Sets the source entity of this event, that defines its sender. -
setDestination
Description copied from interface:SimEvent
Sets the destination entity of this event, that defines its destination.- Specified by:
setDestination
in interfaceSimEvent
- 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. -
getListener
Description copied from interface:EventInfo
Gets the listener that was notified about the event.- Specified by:
getListener
in interfaceEventInfo
- 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 sameSimEvent.getTag()
, to know what event is greater than other (i.e. that happens after other), theSimEvent.compareTo(SimEvent)
makes use of this field. -
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 interfaceSimEvent
- Returns:
-
toString
-