Package edu.fiu.jtlex.timeml.data
Class TimeMLSignal
java.lang.Object
edu.fiu.jtlex.timeml.data.TimeMLSignal
- All Implemented Interfaces:
ITimeMLSignal
Default implementation of
ISignal
.- Since:
- jTLEX 1.0
- Author:
- arada002
-
Constructor Summary
ConstructorsConstructorDescriptionTimeMLSignal
(int signalID, String signalString) Creates a new Signal object. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a field-by-field copy clone of the Signal.boolean
Checks if this Signal equals an object.int
getID()
Returns the ID of a Signal.getIdStr()
Returns the String format of a Signal ID.Returns the String of a Signal.int
hashCode()
Generates a hash code for the signal.toJson()
Returns the String ID and String in JSON format.toString()
Returns the Signal ID and String in String format.
-
Constructor Details
-
TimeMLSignal
Creates a new Signal object.- Parameters:
signalID
- a unique ID number, must be an integer or will be undefinedsignalString
- temporal preposition, conjunction or modifier phrase- Throws:
IllegalArgumentException
- if signalID is less than 1 if signalString is empty or all whitespaceNullPointerException
- if signalString is null
-
-
Method Details
-
getID
public int getID()Returns the ID of a Signal. Will never return null due to it being required in constructor.- Specified by:
getID
in interfaceITimeMLSignal
- Returns:
- the ID of a Signal.
- Since:
- jTLEX 1.0
-
getIdStr
Returns the String format of a Signal ID. Will never return null since it is required in constructor.- Specified by:
getIdStr
in interfaceITimeMLSignal
- Returns:
- the ID of a Signal in String format.
- Since:
- jTLEX 1.0
-
getSignalString
Returns the String of a Signal. Will never return null because constructor requires a valid string.- Specified by:
getSignalString
in interfaceITimeMLSignal
- Returns:
- the String of a Signal.
- Since:
- jTLEX 1.0
-
toString
Returns the Signal ID and String in String format. Will never return null due to constructor requiring them.- Specified by:
toString
in interfaceITimeMLSignal
- Overrides:
toString
in classObject
- Returns:
- the Signal ID and String as a String.
- Since:
- jTLEX 1.0
-
toJson
Returns the String ID and String in JSON format. Will never return null due to constructor.- Specified by:
toJson
in interfaceITimeMLSignal
- Returns:
- JSON Formatted String of Signal ID and String.
- Since:
- jTLEX 1.0
-
clone
Returns a field-by-field copy clone of the Signal. Will never return null, will always return a valid clone.- Specified by:
clone
in interfaceITimeMLSignal
- Overrides:
clone
in classObject
- Returns:
- copy of Signal.
- Since:
- jTLEX 1.0
-
hashCode
public int hashCode()Generates a hash code for the signal.- Specified by:
hashCode
in interfaceITimeMLSignal
- Overrides:
hashCode
in classObject
- Returns:
- The hash code.
- Since:
- jTLEX 1.0
-
equals
Checks if this Signal equals an object.- Specified by:
equals
in interfaceITimeMLSignal
- Overrides:
equals
in classObject
- Parameters:
o
- The object to compare against.- Returns:
- True if both signals are equal, i.e. same ID and string, or else false.
- Throws:
NullPointerException
- If the object to compare against is false.- Since:
- jTLEX 1.0
-