Class SingleTargetEvent

java.lang.Object
microsim.event.Event
microsim.event.SingleTargetEvent
All Implemented Interfaces:
Comparable<Event>

public class SingleTargetEvent extends Event
The simplest implementation of Event class. It represents an event to be passed to one specific object only. It is often used in discrete event simulations, when an object schedule itself for a future event.
  • Field Details

    • eventType

      protected Enum<?> eventType
    • methodInvoker

      protected Method methodInvoker
    • object

      protected Object object
  • Constructor Details

    • SingleTargetEvent

      public SingleTargetEvent(@NonNull @NonNull Object object, @NonNull @NonNull String method) throws SimulationException
      Creates a new event using late binding.
      Parameters:
      object - An Object.
      method - The method name.
      Throws:
      SimulationException - when no such method exists.
      NullPointerException - when any of the input parameters is null.
    • SingleTargetEvent

      public SingleTargetEvent(@NonNull @NonNull Object object, @NonNull @NonNull Enum<?> actionType)
      Creates a new event using early binding.
      Parameters:
      object - An Object.
      actionType - The type of action to invoke.
      Throws:
      NullPointerException - when any of the input parameters is null.
  • Method Details

    • toString

      @NonNull public @NonNull String toString()
      Converts this event to a string.
      Overrides:
      toString in class Object
      Returns:
      the string representation of an object.
    • fireEvent

      public void fireEvent()
      Fires the event by calling the target object.
      Specified by:
      fireEvent in class Event