Package edu.fiu.jtlex.timeml.data
Class TimeMLEvent
java.lang.Object
edu.fiu.jtlex.timeml.data.TimeMLEvent
- All Implemented Interfaces:
ITimeMLEvent
Default implementation of
ITimeMLEvent
.- Since:
- jTLEX 1.0
- Author:
- arada002
-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.fiu.jtlex.timeml.data.ITimeMLEvent
ITimeMLEvent.EventClass
-
Constructor Summary
ConstructorsConstructorDescriptionTimeMLEvent
(int eID, ITimeMLEvent.EventClass eventClass, String stem) Creates a new Event with the specified information. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a field-by-field copy of the Event.boolean
Checks if this event equals an object.Returns the event class of an Event.int
getId()
Returns the eID of an Event.getIdStr()
Grabs the eID, adds an e to the front for String format and returns.Returns the IDs of the instances related to the Event.getStem()
Returns the stem of an Event.int
hashCode()
Generates a hash code for the event.void
setInstance
(ITimeMLInstance instance) Sets the related Instance for the event.toJson()
Converts the Event and it's info into JSON Format.toString()
Returns the info of an Event in String Format.
-
Constructor Details
-
TimeMLEvent
Creates a new Event with the specified information.- Parameters:
eID
- id of the event; may not be 0 or negative, must be an integereventClass
- the class of the entry may not benull
, must be an EventClass enumstem
- the stem attribute of the event; may not be empty string or all whitespace; may benull
if stem is not included in annotation- Throws:
NullPointerException
- if eventClass argument isnull
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 interfaceITimeMLEvent
- Returns:
- the eID of an Event.
- Since:
- jTLEX 1.0
-
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 interfaceITimeMLEvent
- Returns:
- the eID of an Event in String format.
- Since:
- jTLEX 1.0
-
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 interfaceITimeMLEvent
- Returns:
- the stem of an Event.
- Since:
- jTLEX 1.0
-
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 interfaceITimeMLEvent
- Returns:
- the event class of an Event.
- Since:
- jTLEX 1.0
-
toString
Returns the info of an Event in String Format. Will never return a null string.- Specified by:
toString
in interfaceITimeMLEvent
- Overrides:
toString
in classObject
- Returns:
- the info of an Event in String Format.
- Since:
- jTLEX 1.0
-
setInstance
Sets the related Instance for the event. May be null.- Specified by:
setInstance
in interfaceITimeMLEvent
- Parameters:
instance
- theITimeMLInstance
to connect to the event.- Since:
- jTLEX 1.0
-
getInstances
Returns the IDs of the instances related to the Event. May be null- Specified by:
getInstances
in interfaceITimeMLEvent
- Returns:
- the int ID of the Instances related to the event.
- Since:
- jTLEX 1.0
-
toJson
Converts the Event and it's info into JSON Format. Will never return a null string.- Specified by:
toJson
in interfaceITimeMLEvent
- Returns:
- the JSON format of an Event.
- Since:
- jTLEX 1.0
-
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 interfaceITimeMLEvent
- Overrides:
clone
in classObject
- 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 interfaceITimeMLEvent
- Overrides:
hashCode
in classObject
- Returns:
- The hash code.
- Since:
- jTLEX 1.0
-
equals
Checks if this event equals an object.- Specified by:
equals
in interfaceITimeMLEvent
- Overrides:
equals
in classObject
- 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
-