Interface SimEntity
- All Superinterfaces:
Comparable<SimEntity>,Identifiable,Nameable,Runnable
- All Known Subinterfaces:
Datacenter,DatacenterBroker,SimEntityNullBase,Switch
- All Known Implementing Classes:
AbstractSwitch,AggregateSwitch,CloudInformationService,CloudSimEntity,DatacenterBrokerAbstract,DatacenterBrokerBestFit,DatacenterBrokerFirstFit,DatacenterBrokerHeuristic,DatacenterBrokerSimple,DatacenterSimple,EdgeSwitch,HostFaultInjection,NetworkDatacenter,PowerMeter,RootSwitch
An interface that represents a simulation entity.
An entity handles events and can send events to other entities.
- Since:
- CloudSim Plus 1.0
- Author:
- Marcos Dias de Assuncao, Manoel Campos da Silva Filho
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondoubledoublegetState()booleanisAlive()booleanbooleanvoidprocessEvent(SimEvent evt) Processes events or services that are available for the entity.voidrun()Starts the run loop to process events fired during the simulation.booleanschedule(double delay, int tag) Sends an event from the entity to itself with no data.booleanSends an event from the entity to itself.default booleanschedule(int tag) Sends an event from the entity to itself with no delay.booleanSends an event from the entity to itself with no delay.booleanSends an event where all data required is defined inside the event instance.booleanSends an event to another entity with no attached data.booleanSends an event to another entity.Sets the Entity name.setState(@NonNull SimEntity.State state) Sets the entity state.voidshutdown()Shuts down the entity.booleanstart()Starts the entity during simulation start.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.cloudsimplus.core.Identifiable
getId
-
Field Details
-
NULL
-
-
Method Details
-
getStartTime
double getStartTime()- Returns:
- the time the entity was started (in seconds) or -1 if it hasn't started yet.
-
getShutdownTime
double getShutdownTime()- Returns:
- the time the entity was shutdown (in seconds),
or -1 if the entity
isAlive()yet.
-
getState
SimEntity.State getState()- Returns:
- the entity state.
-
setState
Sets the entity state.- Parameters:
state- the new state to set
-
isStarted
boolean isStarted()- Returns:
- true if the entity already was started, false otherwise.
-
isAlive
boolean isAlive()- Returns:
- true if the entity is alive, i.e, it's not finished; false otherwise.
-
isFinished
boolean isFinished()- Returns:
- true if the entity is finished, false otherwise.
-
getSimulation
Simulation getSimulation()- Returns:
- the
CloudSimPlusinstance that represents the simulation to which the Entity belongs to.
-
processEvent
Processes events or services that are available for the entity. This method is invoked, by theCloudSimPlusclass, whenever there is an event in the deferred queue that needs to be processed by the entity.- Parameters:
evt- information about the event just happened
-
schedule
Sends an event where all data required is defined inside the event instance.- Parameters:
evt- the event to send- Returns:
- true if the event was sent; false if the simulation was not started yet
-
schedule
default boolean schedule(int tag) Sends an event from the entity to itself with no delay.- Parameters:
tag- a tag representing the type of event, according to theCloudSimTagor some custom one.- Returns:
- true if the event was sent; false if the simulation was not started yet
-
schedule
Sends an event from the entity to itself.- Parameters:
delay- How many seconds after the current simulation time the event should be senttag- a tag representing the type of event, according to theCloudSimTagor some custom one.data- The data to be sent with the event, according to the tag- Returns:
- true if the event was sent; false if the simulation was not started yet
-
schedule
boolean schedule(double delay, int tag) Sends an event from the entity to itself with no data.- Parameters:
delay- How many seconds after the current simulation time the event should be senttag- a tag representing the type of event, according to theCloudSimTagor some custom one.- Returns:
- true if the event was sent; false if the simulation was not started yet
-
schedule
Sends an event to another entity.- Parameters:
dest- the destination entitydelay- How many seconds after the current simulation time the event should be senttag- a tag representing the type of event, according to theCloudSimTagor some custom one.data- The data to be sent with the event, according to the tag- Returns:
- true if the event was sent; false if the simulation was not started yet
-
schedule
Sends an event to another entity with no attached data.- Parameters:
dest- the destination entitydelay- How many seconds after the current simulation time the event should be senttag- a tag representing the type of event, according to theCloudSimTagor some custom one.- Returns:
- true if the event was sent; false if the simulation was not started yet
-
schedule
Sends an event from the entity to itself with no delay.- Parameters:
tag- a tag representing the type of event, according to theCloudSimTagor some custom one.data- The data to be sent with the event, according to the tag- Returns:
- true if the event was sent; false if the simulation was not started yet
-
run
void run()Starts the run loop to process events fired during the simulation. The events that will be processed are defined in theprocessEvent(SimEvent)method. -
start
boolean start()Starts the entity during simulation start. This method is invoked by theCloudSimPlusclass when the simulation is started.- Returns:
- true if the entity started successfully; false if it was already started
-
shutdown
void shutdown()Shuts down the entity. This method is invoked byCloudSimPlusbefore the simulation finishes. If you want to save data in log files, this is the method in which the corresponding code may be placed. -
setName
Sets the Entity name.- Parameters:
newName- the new name- Returns:
- this entity instance
- Throws:
IllegalArgumentException- when the entity name is null or empty
-