Package edu.fiu.jtlex.timeml.data
Class TimeMLTimex
java.lang.Object
edu.fiu.jtlex.timeml.data.TimeMLTimex
- All Implemented Interfaces:
ITimeMLTimex
,ITimeMLNode
Default implementation of
ITimeMLTimex
.- Since:
- jTLEX 1.0
- Author:
- ceber003
-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.fiu.jtlex.timeml.graph.ITimeMLNode
ITimeMLNode.IType
Nested classes/interfaces inherited from interface edu.fiu.jtlex.timeml.data.ITimeMLTimex
ITimeMLTimex.FunctionInDocument, ITimeMLTimex.TimexMod, ITimeMLTimex.TimexType
-
Constructor Summary
ConstructorsConstructorDescriptionTimeMLTimex
(int tID, ITimeMLTimex.TimexType type, String value, ITimeMLTimex.TimexMod mod, boolean temporalFunction, int anchorID, ITimeMLTimex.FunctionInDocument documentFunction, int beginPoint, int endPoint, String quant, String freq, String phrase) Creates a new Timex with the specified information. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a field-by-field copy of the Timex.boolean
Checks if this Timex equals an object.int
Returns the integer part of the anchortimeId.Returns the string part of the anchortimeId.int
Returns the integer part of the beginpointId.Returns the string part of the beginpointId.int
Returns the integer part of the endpointId.Returns the string part of the endpointId.getFreq()
Returns frequency String portion.Returns the function to which the object belongs.int
getId()
Returns the tID of the timex.getIdStr()
Grabs the tID, adds a t to the front for String format and returns.getMod()
Returns the mod to which the object belongs.Returns the phrase from the text annotated as timex.getQuant()
Returns the quantity to which the object belongs.boolean
Returns the inary attribute which expresses that the value of the temporal expression needs to be determined via evaluation of a temporal function.getType()
Returns the type of the timex.getValue()
Returns the string representation of the value.boolean
getValueDigits
(String value) Returns true if the the value is at least 4 digits.toJson()
Converts the Timex and its info into JSON format.toString()
Returns the info of the Timex in String format.
-
Constructor Details
-
TimeMLTimex
public TimeMLTimex(int tID, ITimeMLTimex.TimexType type, String value, ITimeMLTimex.TimexMod mod, boolean temporalFunction, int anchorID, ITimeMLTimex.FunctionInDocument documentFunction, int beginPoint, int endPoint, String quant, String freq, String phrase) Creates a new Timex with the specified information.- Parameters:
tID
- id of the timex; may not be negativetype
- the type of the timex may not be nullvalue
- the value attribute of the timexmod
- the mod of the value, is optionaltemporalFunction
- true or falseanchorID
- the id of another timex anchored to the current timex, optionaldocumentFunction
- the function a timex is providing within the document, is 'NONE' when not specified.beginPoint
- beginpoint is used if the timex is anchored to another, can be nullendPoint
- end is used if timex is anchored to another timex, can be nullquant
- used only if timex type is 'SET' is the literal describing the timex rate of occurrencefreq
- used only if timex type is 'SET' is the frequency the timex occursphrase
- the phase associated with this this timex.- Throws:
NullPointerException
- if type or value is nullIllegalArgumentException
- if tID, anchorId, beginPoint, or endPoint is negative
-
-
Method Details
-
getValueDigits
Returns true if the the value is at least 4 digits. Also checks if value equals PXY, PAST_REF, PRESENT_REF or FUTURE_REF to return true. Will return false if null.- Parameters:
value
- a String that contains a numeric value- Returns:
- true if the value has at least 4 digits
- Since:
- jTLEX 1.0
-
getId
public int getId()Returns the tID of the timex. Will never be null as it is required for the constructor.- Specified by:
getId
in interfaceITimeMLNode
- Specified by:
getId
in interfaceITimeMLTimex
- Returns:
- the tID of the timex.
- Since:
- jTLEX 1.0
-
getIdStr
Grabs the tID, adds a t to the front for String format and returns. Will never be null since the tID was required in the constructor.- Specified by:
getIdStr
in interfaceITimeMLNode
- Specified by:
getIdStr
in interfaceITimeMLTimex
- Returns:
- the tID of the timex in String format.
- Since:
- jTLEX 1.0
-
getType
Returns the type of the timex.- Specified by:
getType
in interfaceITimeMLNode
- Specified by:
getType
in interfaceITimeMLTimex
- Returns:
- the type of the timex.
- Since:
- jTLEX 1.0
-
getValue
Returns the string representation of the value. The value of the the timex tag determines what the actual amount of time for the date, time, duration, and set types. Will never be null as it is required in the constructor.- Specified by:
getValue
in interfaceITimeMLTimex
- Returns:
- the string representation of the value.
- Since:
- jTLEX 1.0
-
getMod
Returns the mod to which the object belongs. This value is optional and can be null.- Specified by:
getMod
in interfaceITimeMLTimex
- Returns:
- the mod to which the object belongs.
- Since:
- jTLEX 1.0
- See Also:
-
getTemporalFunction
public boolean getTemporalFunction()Returns the inary attribute which expresses that the value of the temporal expression needs to be determined via evaluation of a temporal function. Cannot be null as is a required boolean.- Specified by:
getTemporalFunction
in interfaceITimeMLTimex
- Returns:
- the inary attribute which expresses that the value of the temporal expression needs to be determined via evaluation of a temporal function.
- Since:
- jTLEX 1.0
-
getAnchorTimeId
public int getAnchorTimeId()Returns the integer part of the anchortimeId. Each anchortime has to be identified by a unique ID number. This value is optional. If included, it must not be negative.- Specified by:
getAnchorTimeId
in interfaceITimeMLTimex
- Returns:
- the integer part of the anchortimeId.
- Since:
- jTLEX 1.0
-
getAnchorTimeIdStr
Returns the string part of the anchortimeId. Each anchortime has to be identified by a unique ID number. This value is optional. If included, it must not be negative.- Specified by:
getAnchorTimeIdStr
in interfaceITimeMLTimex
- Returns:
- the string part of the anchortimeId. May not be null.
- Since:
- jTLEX 1.0
-
getFunction
Returns the function to which the object belongs. Function in document can be one of seven values. If it is not specified then it will be set as 'NONE' by default. It can be set to null.- Specified by:
getFunction
in interfaceITimeMLTimex
- Returns:
- the function to which the object belongs.
- Since:
- jTLEX 1.0
-
getBeginPoint
public int getBeginPoint()Returns the integer part of the beginpointId. Beginpoint is only used if the expression is anchored to another timex expression. Each beginpoint has to be identified by a unique ID number. If only endpoint is provided may create an empty timex to fill in. It cannot be null, as it is required in constructor. It cannot be negative either.- Specified by:
getBeginPoint
in interfaceITimeMLTimex
- Returns:
- the integer part of the beginpointId. May not be negative
- Since:
- jTLEX 1.0
-
getBeginPointStr
Returns the string part of the beginpointId. Beginpoint is only used if the expression is anchored to another timex expression. Each beginpoint has to be identified by a unique ID number. If only endpoint is provided may create an empty timex to fill in. It cannot be null as it is required in constructor. It cannot be negative either.- Specified by:
getBeginPointStr
in interfaceITimeMLTimex
- Returns:
- the string part of the beginpointId.
- Since:
- jTLEX 1.0
-
getEndPoint
public int getEndPoint()Returns the integer part of the endpointId. Endpoint is only used if the expression is anchored to another timex expression. Each endpoint has to be identified by a unique ID number. If only beginpoint is provided may create an empty timex to fill in. It cannot be null as it is required in constructor. It cannot be negative either.- Specified by:
getEndPoint
in interfaceITimeMLTimex
- Returns:
- the integer part of the endpointId.
- Since:
- jTLEX 1.0
-
getEndPointStr
Returns the string part of the endpointId. Endpoint is only used if the expression is anchored to another timex expression. Each endpoint has to be identified by a unique ID number. If only beginpoint is provided may create an empty timex to fill in. It cannot be null as it is required in constructor. It cannot be negative either.- Specified by:
getEndPointStr
in interfaceITimeMLTimex
- Returns:
- the string part of the endpointId.
- Since:
- jTLEX 1.0
-
getQuant
Returns the quantity to which the object belongs. The quant value is only used if the timex type is 'SET'. It can be set to null.- Specified by:
getQuant
in interfaceITimeMLTimex
- Returns:
- the quantity to which the object belongs.
- Since:
- jTLEX 1.0
-
getFreq
Returns frequency String portion. The frequency value is only used if the timex type is 'SET'. The integer value determines the number of time the frequency takes. i.e: 2 Weeks, 3 Months, 1 Day, etc. It can be set to null.- Specified by:
getFreq
in interfaceITimeMLTimex
- Returns:
- frequency String portion.
- Since:
- jTLEX 1.0
-
getPhrase
Returns the phrase from the text annotated as timex. It can be set to null.- Specified by:
getPhrase
in interfaceITimeMLTimex
- Returns:
- the phrase from the text annotated as timex.
- Since:
- jTLEX 1.0
-
toString
Returns the info of the Timex in String format. Will never return null.- Specified by:
toString
in interfaceITimeMLTimex
- Overrides:
toString
in classObject
- Returns:
- the info of the Timex in String format.
- Since:
- jTLEX 1.0
-
toJson
Converts the Timex and its info into JSON format. Will never return null.- Specified by:
toJson
in interfaceITimeMLNode
- Specified by:
toJson
in interfaceITimeMLTimex
- Returns:
- the JSON format of the Timex.
- Since:
- jTLEX 1.0
-
clone
Creates and returns a field-by-field copy of the Timex. Will never return null.- Specified by:
clone
in interfaceITimeMLNode
- Specified by:
clone
in interfaceITimeMLTimex
- Overrides:
clone
in classObject
- Returns:
- a copy of the Timex.
- Since:
- jTLEX 1.0
-
equals
Checks if this Timex equals an object.- Specified by:
equals
in interfaceITimeMLNode
- Specified by:
equals
in interfaceITimeMLTimex
- Overrides:
equals
in classObject
- Parameters:
o
- The object to compare against.- Returns:
- True if both timexes are equal, i.e. same ID and type, or else false.
- Throws:
NullPointerException
- If the object to compare against is false.- Since:
- jTLEX 1.0
-