Package edu.fiu.jtlex.data
Class Timex
java.lang.Object
edu.fiu.jtlex.data.Timex
public class Timex extends java.lang.Object implements ITimex
Default implementation of
ITimex.- Author:
- ceber003
-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.fiu.jtlex.data.ITimex
ITimex.FunctionInDocument, ITimex.TimexMod, ITimex.TimexType -
Constructor Summary
Constructors Constructor Description Timex(int tID, ITimex.TimexType type, java.lang.String value, ITimex.TimexMod mod, boolean temporalFunction, int anchorID, ITimex.FunctionInDocument documentFunction, int beginPoint, int endPoint, java.lang.String quant, java.lang.String freq, java.lang.String phrase)Creates a new Timex with the specified information. -
Method Summary
Modifier and Type Method Description voidaddInLink(ILink link)Add a link to the set of IN links from this node.voidaddOutLink(ILink link)Add a link to the set of OUT links from this node.Timexclone()Creates and returns a copy of the Timex.intgetAnchorTimeId()Returns the integer part of the anchortimeId.java.lang.StringgetAnchorTimeIdStr()Returns the string part of the anchortimeId.intgetBeginPoint()Returns the integer part of the beginpointId.java.lang.StringgetBeginPointStr()Returns the string part of the beginpointId.intgetEndPoint()Returns the integer part of the endpointId.java.lang.StringgetEndPointStr()Returns the string part of the endpointId.java.lang.StringgetFreq()Returns frequency String portion.ITimex.FunctionInDocumentgetFunction()Returns the function to which the object belongs.intgetId()Returns the tID of the timex.java.lang.StringgetIdStr()Grabs the tID, adds a t to the front for String format and returns.java.util.Set<ILink>getInLinks()Returns the set of TimeML links which come to this node.ITimex.TimexModgetMod()Returns the mod to which the object belongs.java.util.Set<ILink>getOutLinks()Returns the set of TimeML links which come from this node.java.lang.StringgetPhrase()Returns the phrase from the text annotated as timex.java.lang.StringgetQuant()Returns the quantity to which the object belongs.booleangetTemporalFunction()Returns the inary attribute which expresses that the value of the temporal expression needs to be determined via evaluation of a temporal function.ITimex.TimexTypegetType()Returns the type of the timex.java.lang.StringgetValue()Returns the string representation of the value.booleangetValueDigits(java.lang.String value)Returns true if the the value is at least 4 digits.voidremoveInLink(ILink link)Removes a TimeML link from the set of links that end in this node.voidremoveOutLink(ILink link)Removes a TimeML link from the set of links that start in this node.java.lang.StringtoJSON()Converts the Timex and its info into JSON format.java.lang.StringtoString()Returns the info of the Timex in String format.
-
Constructor Details
-
Timex
public Timex(int tID, ITimex.TimexType type, java.lang.String value, ITimex.TimexMod mod, boolean temporalFunction, int anchorID, ITimex.FunctionInDocument documentFunction, int beginPoint, int endPoint, java.lang.String quant, java.lang.String freq, java.lang.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:
java.lang.NullPointerException- if type or value is nulljava.lang.IllegalArgumentException- if tID, acnhorId, beginPoint, or endPoint is negative
-
-
Method Details
-
getValueDigits
public boolean getValueDigits(java.lang.String value)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.- Parameters:
value- a String that contains a numeric value- Returns:
- true if the value has at least 4 digits
-
getId
public int getId()Returns the tID of the timex. -
getIdStr
public java.lang.String getIdStr()Grabs the tID, adds a t to the front for String format and returns. -
getType
Returns the type of the timex. -
getValue
public java.lang.String 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. -
getMod
Returns the mod to which the object belongs. This value is optional.- Specified by:
getModin interfaceITimex- Returns:
- the mod to which the object belongs.
May be
null. - See Also:
ITimex.TimexMod
-
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.- Specified by:
getTemporalFunctionin interfaceITimex- Returns:
- the inary attribute which expresses that the value of the temporal expression needs to be determined via evaluation of a temporal function.
-
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.- Specified by:
getAnchorTimeIdin interfaceITimex- Returns:
- the integer part of the anchortimeId. May not be negative
-
getAnchorTimeIdStr
public java.lang.String getAnchorTimeIdStr()Returns the string part of the anchortimeId. Each anchortime has to be identified by a unique ID number. This value is optional.- Specified by:
getAnchorTimeIdStrin interfaceITimex- Returns:
- the string part of the anchortimeId. May not be null.
-
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.- Specified by:
getFunctionin interfaceITimex- Returns:
- the function to which the object belongs.
May be
null.
-
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.- Specified by:
getBeginPointin interfaceITimex- Returns:
- the integer part of the beginpointId. May not be negative
-
getBeginPointStr
public java.lang.String 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.- Specified by:
getBeginPointStrin interfaceITimex- Returns:
- the string part of the beginpointId.
May not be
null.
-
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.- Specified by:
getEndPointin interfaceITimex- Returns:
- the integer part of the endpointId. May not be negative.
-
getEndPointStr
public java.lang.String 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.- Specified by:
getEndPointStrin interfaceITimex- Returns:
- the string part of the endpointId.
May not be
null.
-
getQuant
public java.lang.String getQuant()Returns the quantity to which the object belongs. The quant value is only used if the timex type is 'SET'. -
getFreq
public java.lang.String 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. -
getPhrase
public java.lang.String getPhrase()Returns the phrase from the text annotated as timex. -
addOutLink
Add a link to the set of OUT links from this node.- Specified by:
addOutLinkin interfaceINode- Specified by:
addOutLinkin interfaceITimex- Parameters:
link- : A new OUT link from this node.
-
addInLink
Add a link to the set of IN links from this node. -
getOutLinks
Returns the set of TimeML links which come from this node.- Specified by:
getOutLinksin interfaceINode- Specified by:
getOutLinksin interfaceITimex- Returns:
- the set of TimeML links which come from this node.
-
getInLinks
Returns the set of TimeML links which come to this node.- Specified by:
getInLinksin interfaceINode- Specified by:
getInLinksin interfaceITimex- Returns:
- the set of TimeML links which come to this node.
-
removeOutLink
Removes a TimeML link from the set of links that start in this node.- Specified by:
removeOutLinkin interfaceINode- Specified by:
removeOutLinkin interfaceITimex- Parameters:
link- a new OUT link to remove from the set of outgoing links.
-
removeInLink
Removes a TimeML link from the set of links that end in this node.- Specified by:
removeInLinkin interfaceINode- Specified by:
removeInLinkin interfaceITimex- Parameters:
link- a new In link to remove from the set of incoming links.
-
toString
public java.lang.String toString()Returns the info of the Timex in String format.- Overrides:
toStringin classjava.lang.Object- Returns:
- the info of the Timex in String format.
-
toJSON
public java.lang.String toJSON()Converts the Timex and its info into JSON format. -
clone
Creates and returns a copy of the Timex.
-