Class TimeMLEvent

java.lang.Object
edu.fiu.jtlex.timeml.data.TimeMLEvent
All Implemented Interfaces:
ITimeMLEvent

public class TimeMLEvent extends Object implements ITimeMLEvent
Default implementation of ITimeMLEvent.
Since:
jTLEX 1.0
Author:
arada002
  • Constructor Details

    • TimeMLEvent

      public TimeMLEvent(int eID, ITimeMLEvent.EventClass eventClass, String stem)
      Creates a new Event with the specified information.
      Parameters:
      eID - id of the event; may not be 0 or negative, must be an integer
      eventClass - the class of the entry may not be null, must be an EventClass enum
      stem - the stem attribute of the event; may not be empty string or all whitespace; may be null if stem is not included in annotation
      Throws:
      NullPointerException - if eventClass argument is null
      IllegalArgumentException - if the stem is empty or all whitespace or eID is 0/negative/not an integer or if the eventClass is not an enum.
  • Method Details

    • getId

      public int getId()
      Returns the eID of an Event. eID must always be an integer greater than 0. Will never return null as the Event constructor requires a valid eID for the object to be created.
      Specified by:
      getId in interface ITimeMLEvent
      Returns:
      the eID of an Event.
      Since:
      jTLEX 1.0
    • getIdStr

      public String getIdStr()
      Grabs the eID, adds an e to the front for String format and returns. Will never return null as the Event constructor requires a valid eID for the object to be created.
      Specified by:
      getIdStr in interface ITimeMLEvent
      Returns:
      the eID of an Event in String format.
      Since:
      jTLEX 1.0
    • getStem

      public String getStem()
      Returns the stem of an Event. Will never return null as the Event constructor checks for a valid stem while creating the Event object.
      Specified by:
      getStem in interface ITimeMLEvent
      Returns:
      the stem of an Event.
      Since:
      jTLEX 1.0
    • getEventClass

      public ITimeMLEvent.EventClass getEventClass()
      Returns the event class of an Event. Will never return null as the Event Constructor requires an Event Class while creating the object.
      Specified by:
      getEventClass in interface ITimeMLEvent
      Returns:
      the event class of an Event.
      Since:
      jTLEX 1.0
    • toString

      public String toString()
      Returns the info of an Event in String Format. Will never return a null string.
      Specified by:
      toString in interface ITimeMLEvent
      Overrides:
      toString in class Object
      Returns:
      the info of an Event in String Format.
      Since:
      jTLEX 1.0
    • setInstance

      public void setInstance(ITimeMLInstance instance)
      Sets the related Instance for the event. May be null.
      Specified by:
      setInstance in interface ITimeMLEvent
      Parameters:
      instance - the ITimeMLInstance to connect to the event.
      Since:
      jTLEX 1.0
    • getInstances

      public Set<Integer> getInstances()
      Returns the IDs of the instances related to the Event. May be null
      Specified by:
      getInstances in interface ITimeMLEvent
      Returns:
      the int ID of the Instances related to the event.
      Since:
      jTLEX 1.0
    • toJson

      public String toJson()
      Converts the Event and it's info into JSON Format. Will never return a null string.
      Specified by:
      toJson in interface ITimeMLEvent
      Returns:
      the JSON format of an Event.
      Since:
      jTLEX 1.0
    • clone

      public TimeMLEvent clone()
      Creates and returns a field-by-field copy of the Event. Will never return a null or empty Event object.
      Specified by:
      clone in interface ITimeMLEvent
      Overrides:
      clone in class Object
      Returns:
      a copy of an Event.
      Since:
      jTLEX 1.0
    • hashCode

      public int hashCode()
      Generates a hash code for the event.
      Specified by:
      hashCode in interface ITimeMLEvent
      Overrides:
      hashCode in class Object
      Returns:
      The hash code.
      Since:
      jTLEX 1.0
    • equals

      public boolean equals(Object o)
      Checks if this event equals an object.
      Specified by:
      equals in interface ITimeMLEvent
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare against.
      Returns:
      True if both events are equal, i.e. same ID and eventClass, or else false.
      Throws:
      NullPointerException - If the object to compare against is false.
      Since:
      jTLEX 1.0