Package org.cloudbus.cloudsim.core
Interface SimEntityNullBase
- All Superinterfaces:
Cloneable
,Comparable<SimEntity>
,Identifiable
,Nameable
,Runnable
,SimEntity
public interface SimEntityNullBase extends SimEntity
A base interface used internally to implement the Null Object Design Pattern
for interfaces extending
SimEntity
.
It's just used to avoid the boilerplate code in such Null Object implementations.- Author:
- Manoel Campos da Silva Filho
- See Also:
SimEntity.NULL
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.core.SimEntity
SimEntity.State
-
Field Summary
-
Method Summary
Modifier and Type Method Description default long
getId()
default String
getName()
default double
getShutdownTime()
Gets the time the entity was shutdown (in seconds).default Simulation
getSimulation()
Gets the CloudSim instance that represents the simulation to each the Entity is related to.default double
getStartTime()
Gets the time the entity was started.default SimEntity.State
getState()
Gets the entity state.default boolean
isAlive()
Checks if the entity is alive, i.e, it's not finished.default boolean
isFinished()
Checks if the entity is finished or not.default boolean
isStarted()
Checks if the entity already was started or not.default void
processEvent(SimEvent evt)
Processes events or services that are available for the entity.default void
run()
The run loop to process events fired during the simulation.default boolean
schedule(double delay, int tag)
Sends an event from the entity to itself with no data.default boolean
schedule(double delay, int tag, Object data)
Sends an event from the entity to itself.default boolean
schedule(int tag, Object data)
Sends an event from the entity to itself with no delay.default boolean
schedule(SimEvent evt)
Sends an event where all data required is defined inside the event instance.default boolean
schedule(SimEntity dest, double delay, int tag)
Sends an event to another entity with no attached data.default boolean
schedule(SimEntity dest, double delay, int tag, Object data)
Sends an event to another entity.default SimEntity
setName(String newName)
Sets the Entity name.default SimEntity
setSimulation(Simulation simulation)
Sets the CloudSim instance that represents the simulation the Entity is related to.default SimEntity
setState(SimEntity.State state)
Sets the entity state.default void
shutdown()
Shuts down the entity.default boolean
start()
Starts the entity during simulation start.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
getState
Description copied from interface:SimEntity
Gets the entity state. -
setState
Description copied from interface:SimEntity
Sets the entity state. -
isStarted
default boolean isStarted()Description copied from interface:SimEntity
Checks if the entity already was started or not. -
isAlive
default boolean isAlive()Description copied from interface:SimEntity
Checks if the entity is alive, i.e, it's not finished. -
isFinished
default boolean isFinished()Description copied from interface:SimEntity
Checks if the entity is finished or not.- Specified by:
isFinished
in interfaceSimEntity
- Returns:
-
getSimulation
Description copied from interface:SimEntity
Gets the CloudSim instance that represents the simulation to each the Entity is related to.- Specified by:
getSimulation
in interfaceSimEntity
- Returns:
-
setSimulation
Description copied from interface:SimEntity
Sets the CloudSim instance that represents the simulation the Entity is related to.- Specified by:
setSimulation
in interfaceSimEntity
- Parameters:
simulation
- The simulation instance the Entity is related to- Returns:
-
processEvent
Description copied from interface:SimEntity
Processes events or services that are available for the entity. This method is invoked by theCloudSim
class whenever there is an event in the deferred queue, which needs to be processed by the entity.- Specified by:
processEvent
in interfaceSimEntity
- Parameters:
evt
- information about the event just happened
-
schedule
Description copied from interface:SimEntity
Sends an event where all data required is defined inside the event instance. -
schedule
Description copied from interface:SimEntity
Sends an event to another entity.- Specified by:
schedule
in interfaceSimEntity
- Parameters:
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.- Returns:
- true if the event was sent, false if the simulation was not started yet
-
schedule
Description copied from interface:SimEntity
Sends an event from the entity to itself.- Specified by:
schedule
in interfaceSimEntity
- Parameters:
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.- Returns:
- true if the event was sent, false if the simulation was not started yet
-
schedule
Description copied from interface:SimEntity
Sends an event to another entity with no attached data.- Specified by:
schedule
in interfaceSimEntity
- Parameters:
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.- Returns:
- true if the event was sent, false if the simulation was not started yet
-
schedule
Description copied from interface:SimEntity
Sends an event from the entity to itself with no delay. -
schedule
default boolean schedule(double delay, int tag)Description copied from interface:SimEntity
Sends an event from the entity to itself with no data. -
run
default void run()Description copied from interface:SimEntity
The run loop to process events fired during the simulation. The events that will be processed are defined in theSimEntity.processEvent(SimEvent)
method.- Specified by:
run
in interfaceRunnable
- Specified by:
run
in interfaceSimEntity
- See Also:
SimEntity.processEvent(SimEvent)
-
start
default boolean start()Description copied from interface:SimEntity
Starts the entity during simulation start. This method is invoked by theCloudSim
class when the simulation is started. -
shutdown
default void shutdown()Description copied from interface:SimEntity
Shuts down the entity. This method is invoked by theCloudSim
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. -
setName
Description copied from interface:SimEntity
Sets the Entity name.- Specified by:
setName
in interfaceSimEntity
- Parameters:
newName
- the new name- Returns:
- Throws:
IllegalArgumentException
- when the entity name is null or empty
-
getName
-
getId
default long getId()- Specified by:
getId
in interfaceIdentifiable
-
getShutdownTime
default double getShutdownTime()Description copied from interface:SimEntity
Gets the time the entity was shutdown (in seconds). If the entitySimEntity.isAlive()
yet, the method returns -1.- Specified by:
getShutdownTime
in interfaceSimEntity
- Returns:
-
getStartTime
default double getStartTime()Description copied from interface:SimEntity
Gets the time the entity was started.- Specified by:
getStartTime
in interfaceSimEntity
- Returns:
- the entity start time or -1 if it haven't started yet.
-