Class Event

java.lang.Object
eds.framework.Event
All Implemented Interfaces:
Comparable<Event>

public class Event extends Object implements Comparable<Event>
Represents a simulation event. An Event contains a type of event, the simulation time at which it occurs, and the related simulation entity. Events are comparable by time and are stored in a priority queue.
  • Constructor Details

    • Event

      public Event(IEventType type, double time, ISimulationEntity entity)
      Creates a new Event.
      Parameters:
      type - the type of the event
      time - the simulation time when the event occurs
      entity - the simulation entity associated with the event
  • Method Details

    • getType

      public IEventType getType()
      Returns the event type.
      Returns:
      the event type
    • getTime

      public double getTime()
      Returns the simulation time of the event.
      Returns:
      event execution time
    • getEntity

      public ISimulationEntity getEntity()
      Returns the simulation entity associated with this event.
      Returns:
      the related simulation entity
    • compareTo

      public int compareTo(Event other)
      Compares this event with another event based on time. Used for ordering events in a priority queue.
      Specified by:
      compareTo in interface Comparable<Event>
      Parameters:
      other - the event to compare with
      Returns:
      a negative integer, zero, or a positive integer as this event time is less than, equal to, or greater than the specified event time