Class TimeMLTimex

java.lang.Object
edu.fiu.jtlex.timeml.data.TimeMLTimex
All Implemented Interfaces:
ITimeMLTimex, ITimeMLNode

public class TimeMLTimex extends Object implements ITimeMLTimex
Default implementation of ITimeMLTimex.
Since:
jTLEX 1.0
Author:
ceber003
  • 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 negative
      type - the type of the timex may not be null
      value - the value attribute of the timex
      mod - the mod of the value, is optional
      temporalFunction - true or false
      anchorID - the id of another timex anchored to the current timex, optional
      documentFunction - 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 null
      endPoint - end is used if timex is anchored to another timex, can be null
      quant - used only if timex type is 'SET' is the literal describing the timex rate of occurrence
      freq - used only if timex type is 'SET' is the frequency the timex occurs
      phrase - the phase associated with this this timex.
      Throws:
      NullPointerException - if type or value is null
      IllegalArgumentException - if tID, anchorId, beginPoint, or endPoint is negative
  • Method Details

    • getValueDigits

      public boolean getValueDigits(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. 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 interface ITimeMLNode
      Specified by:
      getId in interface ITimeMLTimex
      Returns:
      the tID of the timex.
      Since:
      jTLEX 1.0
    • getIdStr

      public String 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 interface ITimeMLNode
      Specified by:
      getIdStr in interface ITimeMLTimex
      Returns:
      the tID of the timex in String format.
      Since:
      jTLEX 1.0
    • getType

      public ITimeMLTimex.TimexType getType()
      Returns the type of the timex.
      Specified by:
      getType in interface ITimeMLNode
      Specified by:
      getType in interface ITimeMLTimex
      Returns:
      the type of the timex.
      Since:
      jTLEX 1.0
    • getValue

      public 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. Will never be null as it is required in the constructor.
      Specified by:
      getValue in interface ITimeMLTimex
      Returns:
      the string representation of the value.
      Since:
      jTLEX 1.0
    • getMod

      public ITimeMLTimex.TimexMod getMod()
      Returns the mod to which the object belongs. This value is optional and can be null.
      Specified by:
      getMod in interface ITimeMLTimex
      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 interface ITimeMLTimex
      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 interface ITimeMLTimex
      Returns:
      the integer part of the anchortimeId.
      Since:
      jTLEX 1.0
    • getAnchorTimeIdStr

      public String 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 interface ITimeMLTimex
      Returns:
      the string part of the anchortimeId. May not be null.
      Since:
      jTLEX 1.0
    • getFunction

      public ITimeMLTimex.FunctionInDocument 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 interface ITimeMLTimex
      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 interface ITimeMLTimex
      Returns:
      the integer part of the beginpointId. May not be negative
      Since:
      jTLEX 1.0
    • getBeginPointStr

      public 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. It cannot be null as it is required in constructor. It cannot be negative either.
      Specified by:
      getBeginPointStr in interface ITimeMLTimex
      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 interface ITimeMLTimex
      Returns:
      the integer part of the endpointId.
      Since:
      jTLEX 1.0
    • getEndPointStr

      public 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. It cannot be null as it is required in constructor. It cannot be negative either.
      Specified by:
      getEndPointStr in interface ITimeMLTimex
      Returns:
      the string part of the endpointId.
      Since:
      jTLEX 1.0
    • getQuant

      public String 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 interface ITimeMLTimex
      Returns:
      the quantity to which the object belongs.
      Since:
      jTLEX 1.0
    • getFreq

      public 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. It can be set to null.
      Specified by:
      getFreq in interface ITimeMLTimex
      Returns:
      frequency String portion.
      Since:
      jTLEX 1.0
    • getPhrase

      public String getPhrase()
      Returns the phrase from the text annotated as timex. It can be set to null.
      Specified by:
      getPhrase in interface ITimeMLTimex
      Returns:
      the phrase from the text annotated as timex.
      Since:
      jTLEX 1.0
    • toString

      public String toString()
      Returns the info of the Timex in String format. Will never return null.
      Specified by:
      toString in interface ITimeMLTimex
      Overrides:
      toString in class Object
      Returns:
      the info of the Timex in String format.
      Since:
      jTLEX 1.0
    • toJson

      public String toJson()
      Converts the Timex and its info into JSON format. Will never return null.
      Specified by:
      toJson in interface ITimeMLNode
      Specified by:
      toJson in interface ITimeMLTimex
      Returns:
      the JSON format of the Timex.
      Since:
      jTLEX 1.0
    • clone

      public TimeMLTimex clone()
      Creates and returns a field-by-field copy of the Timex. Will never return null.
      Specified by:
      clone in interface ITimeMLNode
      Specified by:
      clone in interface ITimeMLTimex
      Overrides:
      clone in class Object
      Returns:
      a copy of the Timex.
      Since:
      jTLEX 1.0
    • equals

      public boolean equals(Object o)
      Checks if this Timex equals an object.
      Specified by:
      equals in interface ITimeMLNode
      Specified by:
      equals in interface ITimeMLTimex
      Overrides:
      equals in class Object
      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