Class SimEvent

java.lang.Object
simEngine.SimEvent
All Implemented Interfaces:
Cloneable

public class SimEvent extends Object implements Cloneable
This class represents events which are passed between the entities in the simulation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor, create a blank event.
  • Method Summary

    Modifier and Type
    Method
    Description
    Create an exact copy of this event.
    double
    Get the simulation time which this event was scheduled for.
    Get the data passed in this event.
    int
    Get the unique id number of the entity which is the destination of this event.
    int
    Get the unique id number of the entity which scheduled this event.
    int
    Get the user-defined tag in this event.
    int
    Get the unique id number of the entity which scheduled this event.
    void
    setDest(int d)
    Set the destination entity of this event.
    void
    setSrc(int s)
    Set the source entity of this event.
    Returns a string representation of the object.
    int
    Get the user-defined tag in this event

    Methods inherited from class Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • time

      public double time
  • Constructor Details

    • SimEvent

      public SimEvent()
      Constructor, create a blank event. Useful for fetching events using methods such as SimEntity.simWait(ev).
  • Method Details

    • getDest

      public int getDest()
      Get the unique id number of the entity which is the destination of this event.
      Returns:
      the id number
    • getSrc

      public int getSrc()
      Get the unique id number of the entity which scheduled this event.
      Returns:
      the id number
    • eventTime

      public double eventTime()
      Get the simulation time which this event was scheduled for.
      Returns:
      The simulation time
    • type

      public int type()
      Get the user-defined tag in this event
      Returns:
      The tag
    • scheduledBy

      public int scheduledBy()
      Get the unique id number of the entity which scheduled this event.
      Returns:
      the id number
    • getTag

      public int getTag()
      Get the user-defined tag in this event.
      Returns:
      The tag
    • getData

      public Object getData()
      Get the data passed in this event.
      Returns:
      A reference to the data
    • clone

      public Object clone()
      Create an exact copy of this event.
      Overrides:
      clone in class Object
      Returns:
      A reference to the copy
    • setSrc

      public void setSrc(int s)
      Set the source entity of this event.
      Parameters:
      s - The unique id number of the entity
    • setDest

      public void setDest(int d)
      Set the destination entity of this event.
      Parameters:
      d - The unique id number of the entity
    • toString

      public String toString()
      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

      The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

      getClass().getName() + '@' + Integer.toHexString(hashCode())
      
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.