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.ITypeNested 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.booleanChecks if this Timex equals an object.intReturns the integer part of the anchortimeId.Returns the string part of the anchortimeId.intReturns the integer part of the beginpointId.Returns the string part of the beginpointId.intReturns 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.getID()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.booleanReturns 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.booleangetValueDigits(String value) Returns true if the the value is at least 4 digits.inthashCode()Generates a hash code for the Timex.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
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:
getIDin interfaceITimeMLNode- Specified by:
getIDin interfaceITimeMLTimex- Returns:
- the tID of the timex in String format.
- Since:
- jTLEX 1.0
-
getType
Returns the type of the timex.- Specified by:
getTypein interfaceITimeMLNode- Specified by:
getTypein 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:
getValuein 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:
getModin 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:
getTemporalFunctionin 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:
getAnchorTimeIdin 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:
getAnchorTimeIdStrin 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:
getFunctionin 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:
getBeginPointin 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:
getBeginPointStrin 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:
getEndPointin 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:
getEndPointStrin 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:
getQuantin 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:
getFreqin 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:
getPhrasein 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:
toStringin interfaceITimeMLTimex- Overrides:
toStringin 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:
toJsonin interfaceITimeMLNode- Specified by:
toJsonin 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:
clonein interfaceITimeMLNode- Specified by:
clonein interfaceITimeMLTimex- Overrides:
clonein classObject- Returns:
- a copy of the Timex.
- Since:
- jTLEX 1.0
-
hashCode
public int hashCode()Generates a hash code for the Timex. -
equals
Checks if this Timex equals an object.- Specified by:
equalsin interfaceITimeMLNode- Specified by:
equalsin interfaceITimeMLTimex- Overrides:
equalsin 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
-