Interface SimEntityNullBase

All Superinterfaces:
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:
  • Method Details

    • getState

      default SimEntity.State getState()
      Specified by:
      getState in interface SimEntity
      Returns:
      the entity 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 new state to set
    • isStarted

      default boolean isStarted()
      Specified by:
      isStarted in interface SimEntity
      Returns:
      true if the entity already was started, false otherwise.
    • isAlive

      default boolean isAlive()
      Specified by:
      isAlive in interface SimEntity
      Returns:
      true if the entity is alive, i.e, it's not finished; false otherwise.
    • isFinished

      default boolean isFinished()
      Specified by:
      isFinished in interface SimEntity
      Returns:
      true if the entity is finished, false otherwise.
    • getSimulation

      default Simulation getSimulation()
      Specified by:
      getSimulation in interface SimEntity
      Returns:
      the CloudSimPlus instance that represents the simulation to which the Entity belongs to.
    • 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 CloudSimPlus class, whenever there is an event in the deferred queue that 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 - a tag representing the type of event, according to the CloudSimTag or 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

      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 - a tag representing the type of event, according to the CloudSimTag or 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

      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 - a tag representing the type of event, according to the CloudSimTag or some custom one.
      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 - a tag representing the type of event, according to the CloudSimTag or 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

      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 - a tag representing the type of event, according to the CloudSimTag or some custom one.
      Returns:
      true if the event was sent; false if the simulation was not started yet
    • run

      default void run()
      Description copied from interface: SimEntity
      Starts 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
    • start

      default boolean start()
      Description copied from interface: SimEntity
      Starts the entity during simulation start. This method is invoked by the CloudSimPlus 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 CloudSimPlus before the simulation finishes. If you want to save data in log files, this is the method in which the corresponding code may 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:
      this entity instance
      Throws:
      IllegalArgumentException - when the entity name is null or empty
    • getName

      default String getName()
      Specified by:
      getName in interface Nameable
      Returns:
      the name of this entity
    • getId

      default long getId()
      Specified by:
      getId in interface Identifiable
      Returns:
      the id number assigned to this entity.
    • getShutdownTime

      default double getShutdownTime()
      Specified by:
      getShutdownTime in interface SimEntity
      Returns:
      the time the entity was shutdown (in seconds), or -1 if the entity SimEntity.isAlive() yet.
    • getStartTime

      default double getStartTime()
      Specified by:
      getStartTime in interface SimEntity
      Returns:
      the time the entity was started (in seconds) or -1 if it hasn't started yet.