public interface SimEntity extends Nameable, Cloneable, Runnable, Comparable<SimEntity>
CloudSimEntity
Modifier and Type | Interface and Description |
---|---|
static class |
SimEntity.State
Defines the event state.
|
Modifier and Type | Field and Description |
---|---|
static SimEntity |
NULL
An attribute that implements the Null Object Design Pattern for
SimEntity
objects. |
Modifier and Type | Method and Description |
---|---|
double |
getShutdownTime()
Gets the time the entity was shutdown (in seconds).
|
Simulation |
getSimulation()
Gets the CloudSim instance that represents the simulation to each the Entity is related to.
|
double |
getStartTime()
Gets the time the entity was started.
|
SimEntity.State |
getState()
Gets the entity state.
|
boolean |
isAlive()
Checks if the entity is alive, i.e, it's not finished.
|
boolean |
isFinished()
Checks if the entity is finished or not.
|
boolean |
isStarted()
Checks if the entity already was started or not.
|
void |
processEvent(SimEvent evt)
Processes events or services that are available for the entity.
|
void |
run()
The run loop to process events fired during the simulation.
|
boolean |
schedule(double delay,
int tag)
Sends an event from the entity to itself with no data.
|
boolean |
schedule(double delay,
int tag,
Object data)
Sends an event from the entity to itself.
|
default boolean |
schedule(int tag)
Sends an event from the entity to itself with no delay.
|
boolean |
schedule(int tag,
Object data)
Sends an event from the entity to itself with no delay.
|
boolean |
schedule(SimEntity dest,
double delay,
int tag)
Sends an event to another entity with no attached data.
|
boolean |
schedule(SimEntity dest,
double delay,
int tag,
Object data)
Sends an event to another entity.
|
boolean |
schedule(SimEvent evt)
Sends an event where all data required is defined inside the event instance.
|
SimEntity |
setName(String newName)
Sets the Entity name.
|
SimEntity |
setSimulation(Simulation simulation)
Sets the CloudSim instance that represents the simulation the Entity is related to.
|
SimEntity |
setState(SimEntity.State state)
Sets the entity state.
|
void |
shutdown()
Shuts down the entity.
|
boolean |
start()
Starts the entity during simulation start.
|
getId
compareTo
double getStartTime()
double getShutdownTime()
isAlive()
yet,
the method returns -1.SimEntity.State getState()
SimEntity setState(SimEntity.State state)
state
- the state to setboolean isStarted()
boolean isAlive()
boolean isFinished()
Simulation getSimulation()
SimEntity setSimulation(Simulation simulation)
simulation
- The simulation instance the Entity is related tovoid processEvent(SimEvent evt)
CloudSim
class whenever there is an
event in the deferred queue, which needs to be processed by the entity.evt
- information about the event just happenedboolean schedule(SimEvent evt)
evt
- the event to senddefault boolean schedule(int tag)
tag
- An user-defined number representing the type of event.boolean schedule(double delay, int tag, Object data)
delay
- How many seconds after the current simulation time the event should be senttag
- An user-defined number representing the type of event.data
- The data to be sent with the event.boolean schedule(double delay, int tag)
delay
- How many seconds after the current simulation time the event should be senttag
- An user-defined number representing the type of event.boolean schedule(SimEntity dest, double delay, int tag, Object data)
dest
- the destination entitydelay
- How many seconds after the current simulation time the event should be senttag
- An user-defined number representing the type of event.data
- The data to be sent with the event.boolean schedule(SimEntity dest, double delay, int tag)
dest
- the destination entitydelay
- How many seconds after the current simulation time the event should be senttag
- An user-defined number representing the type of event.boolean schedule(int tag, Object data)
tag
- An user-defined number representing the type of event.data
- The data to be sent with the event.void run()
processEvent(SimEvent)
method.run
in interface Runnable
processEvent(SimEvent)
boolean start()
CloudSim
class when the simulation is started.void shutdown()
CloudSim
before the simulation finishes. If you want to save data in log files
this is the method in which the corresponding code would be placed.SimEntity setName(String newName) throws IllegalArgumentException
newName
- the new nameIllegalArgumentException
- when the entity name is null or emptyCopyright © 2015–2021 Systems, Security and Image Communication Lab - Instituto de Telecomunicações (IT) - Universidade da Beira Interior (UBI) - Instituto Federal de Educação Ciência e Tecnologia do Tocantins (IFTO). All rights reserved.