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

    Fields inherited from interface org.cloudbus.cloudsim.core.SimEntity

    NULL
  • 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

    Methods inherited from interface org.cloudbus.cloudsim.core.SimEntity

    schedule
  • Method Details

    • getState

      default SimEntity.State getState()
      Description copied from interface: SimEntity
      Gets the entity state.
      Specified by:
      getState in interface SimEntity
      Returns:
      the state
    • setState

      default SimEntity setState​(SimEntity.State state)
      Description copied from interface: SimEntity
      Sets the entity state.
      Specified by:
      setState in interface SimEntity
      Parameters:
      state - the state to set
    • isStarted

      default boolean isStarted()
      Description copied from interface: SimEntity
      Checks if the entity already was started or not.
      Specified by:
      isStarted in interface SimEntity
      Returns:
    • isAlive

      default boolean isAlive()
      Description copied from interface: SimEntity
      Checks if the entity is alive, i.e, it's not finished.
      Specified by:
      isAlive in interface SimEntity
      Returns:
    • isFinished

      default boolean isFinished()
      Description copied from interface: SimEntity
      Checks if the entity is finished or not.
      Specified by:
      isFinished in interface SimEntity
      Returns:
    • getSimulation

      default Simulation 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 interface SimEntity
      Returns:
    • setSimulation

      default SimEntity setSimulation​(Simulation simulation)
      Description copied from interface: SimEntity
      Sets the CloudSim instance that represents the simulation the Entity is related to.
      Specified by:
      setSimulation in interface SimEntity
      Parameters:
      simulation - The simulation instance the Entity is related to
      Returns:
    • processEvent

      default void processEvent​(SimEvent evt)
      Description copied from interface: SimEntity
      Processes events or services that are available for the entity. This method is invoked by the CloudSim class whenever there is an event in the deferred queue, which needs to be processed by the entity.
      Specified by:
      processEvent in interface SimEntity
      Parameters:
      evt - information about the event just happened
    • schedule

      default boolean schedule​(SimEvent evt)
      Description copied from interface: SimEntity
      Sends an event where all data required is defined inside the event instance.
      Specified by:
      schedule in interface SimEntity
      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​(SimEntity dest, double delay, int tag, Object data)
      Description copied from interface: SimEntity
      Sends an event to another entity.
      Specified by:
      schedule in interface SimEntity
      Parameters:
      dest - the destination entity
      delay - How many seconds after the current simulation time the event should be sent
      tag - 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

      default boolean schedule​(double delay, int tag, Object data)
      Description copied from interface: SimEntity
      Sends an event from the entity to itself.
      Specified by:
      schedule in interface SimEntity
      Parameters:
      delay - How many seconds after the current simulation time the event should be sent
      tag - 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

      default boolean schedule​(SimEntity dest, double delay, int tag)
      Description copied from interface: SimEntity
      Sends an event to another entity with no attached data.
      Specified by:
      schedule in interface SimEntity
      Parameters:
      dest - the destination entity
      delay - How many seconds after the current simulation time the event should be sent
      tag - 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

      default boolean schedule​(int tag, Object data)
      Description copied from interface: SimEntity
      Sends an event from the entity to itself with no delay.
      Specified by:
      schedule in interface SimEntity
      Parameters:
      tag - 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

      default boolean schedule​(double delay, int tag)
      Description copied from interface: SimEntity
      Sends an event from the entity to itself with no data.
      Specified by:
      schedule in interface SimEntity
      Parameters:
      delay - How many seconds after the current simulation time the event should be sent
      tag - An user-defined number representing the type of event.
      Returns:
      true if the event was sent, false if the simulation was not started yet
    • 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 the SimEntity.processEvent(SimEvent) method.
      Specified by:
      run in interface Runnable
      Specified by:
      run in interface SimEntity
      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 the CloudSim class when the simulation is started.
      Specified by:
      start in interface SimEntity
      Returns:
      true if the entity started successfully, false if it was already started
    • shutdown

      default void shutdown()
      Description copied from interface: SimEntity
      Shuts down the entity. This method is invoked by the 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.
      Specified by:
      shutdown in interface SimEntity
    • setName

      default SimEntity setName​(String newName) throws IllegalArgumentException
      Description copied from interface: SimEntity
      Sets the Entity name.
      Specified by:
      setName in interface SimEntity
      Parameters:
      newName - the new name
      Returns:
      Throws:
      IllegalArgumentException - when the entity name is null or empty
    • getName

      default String getName()
      Specified by:
      getName in interface Nameable
    • getId

      default long getId()
      Specified by:
      getId in interface Identifiable
    • getShutdownTime

      default double getShutdownTime()
      Description copied from interface: SimEntity
      Gets the time the entity was shutdown (in seconds). If the entity SimEntity.isAlive() yet, the method returns -1.
      Specified by:
      getShutdownTime in interface SimEntity
      Returns:
    • getStartTime

      default double getStartTime()
      Description copied from interface: SimEntity
      Gets the time the entity was started.
      Specified by:
      getStartTime in interface SimEntity
      Returns:
      the entity start time or -1 if it haven't started yet.