Class Timex

java.lang.Object
edu.fiu.jtlex.data.Timex
All Implemented Interfaces:
INode, ITimex

public class Timex extends Object implements ITimex
Default implementation of ITimex.
Author:
ceber003
  • Constructor Details

    • Timex

      public Timex​(int tID, ITimex.TimexType type, String value, ITimex.TimexMod mod, boolean temporalFunction, int anchorID, ITimex.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, acnhorId, beginPoint, or endPoint is negative
  • Method Details

    • getId

      public int getId()
      Description copied from interface: INode
      Returns the integer part of the node ID. Each event has to be identified by a unique ID number.
      Specified by:
      getId in interface INode
      Returns:
      Integer part of the node ID. May not be 0 or negative.
    • getIdStr

      public String getIdStr()
      Description copied from interface: INode
      Returns the full string representation of the node ID. Each event has to be identified by a unique ID number and String.
      Specified by:
      getIdStr in interface INode
      Returns:
      Full string representation of the node ID. May not return null.
    • getType

      public ITimex.TimexType getType()
      Description copied from interface: INode
      Return the integer that corresponds with the type. Each event can be categorized under three different types.
      Specified by:
      getType in interface INode
      Returns:
      Enum that corresponds with the type of node.
    • getValue

      public String getValue()
      Description copied from interface: ITimex
      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.
      Specified by:
      getValue in interface ITimex
      Returns:
      the string representation of the value. May not be null.
    • getMod

      public ITimex.TimexMod getMod()
      Description copied from interface: ITimex
      Returns the mod to which the object belongs. This value is optional.
      Specified by:
      getMod in interface ITimex
      Returns:
      the mod to which the object belongs. May be null.
      See Also:
      ITimex.TimexMod
    • getTemporalFunction

      public boolean getTemporalFunction()
      Description copied from interface: ITimex
      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:
      getTemporalFunction in interface ITimex
      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()
      Description copied from interface: ITimex
      Returns the integer part of the anchortimeId. Each anchortime has to be identified by a unique ID number. This value is optional.
      Specified by:
      getAnchorTimeId in interface ITimex
      Returns:
      the integer part of the anchortimeId. May not be negative
    • getAnchorTimeIdStr

      public String getAnchorTimeIdStr()
      Description copied from interface: ITimex
      Returns the string part of the anchortimeId. Each anchortime has to be identified by a unique ID number. This value is optional.
      Specified by:
      getAnchorTimeIdStr in interface ITimex
      Returns:
      the string part of the anchortimeId. May not be null.
    • getFunction

      public ITimex.FunctionInDocument getFunction()
      Description copied from interface: ITimex
      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:
      getFunction in interface ITimex
      Returns:
      the function to which the object belongs. May be null.
    • getBeginPoint

      public int getBeginPoint()
      Description copied from interface: ITimex
      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:
      getBeginPoint in interface ITimex
      Returns:
      the integer part of the beginpointId. May not be negative
    • getBeginPointStr

      public String getBeginPointStr()
      Description copied from interface: ITimex
      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:
      getBeginPointStr in interface ITimex
      Returns:
      the string part of the beginpointId. May not be null.
    • getEndPoint

      public int getEndPoint()
      Description copied from interface: ITimex
      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:
      getEndPoint in interface ITimex
      Returns:
      the integer part of the endpointId. May not be negative.
    • getEndPointStr

      public String getEndPointStr()
      Description copied from interface: ITimex
      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:
      getEndPointStr in interface ITimex
      Returns:
      the string part of the endpointId. May not be null.
    • getQuant

      public String getQuant()
      Description copied from interface: ITimex
      Returns the quantity to which the object belongs. The quant value is only used if the timex type is 'SET'.
      Specified by:
      getQuant in interface ITimex
      Returns:
      the quantity to which the object belongs. May be null.
    • getFreq

      public String getFreq()
      Description copied from interface: ITimex
      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.
      Specified by:
      getFreq in interface ITimex
      Returns:
      frequency String portion. May be null.
    • getPhrase

      public String getPhrase()
      Description copied from interface: ITimex
      Returns the phrase from the text annotated as timex.
      Specified by:
      getPhrase in interface ITimex
      Returns:
      the phrase from the text annotated as timex. May be null.
    • addOutLink

      public void addOutLink​(ILink link)
      Description copied from interface: ITimex
      Add a link to the set of OUT links from this node.
      Specified by:
      addOutLink in interface INode
      Specified by:
      addOutLink in interface ITimex
      Parameters:
      link - : A new OUT link from this node.
    • addInLink

      public void addInLink​(ILink link)
      Description copied from interface: ITimex
      Add a link to the set of IN links from this node.
      Specified by:
      addInLink in interface INode
      Specified by:
      addInLink in interface ITimex
      Parameters:
      link - : A new IN link incoming to this node.
    • getOutLinks

      public Set<ILink> getOutLinks()
      Description copied from interface: ITimex
      Returns the set of TimeML links which come from this node.
      Specified by:
      getOutLinks in interface INode
      Specified by:
      getOutLinks in interface ITimex
      Returns:
      the set of TimeML links which come from this node.
    • getInLinks

      public Set<ILink> getInLinks()
      Description copied from interface: ITimex
      Returns the set of TimeML links which come to this node.
      Specified by:
      getInLinks in interface INode
      Specified by:
      getInLinks in interface ITimex
      Returns:
      the set of TimeML links which come to this node.
    • removeOutLink

      public void removeOutLink​(ILink link)
      Description copied from interface: ITimex
      Removes a TimeML link from the set of links that start in this node.
      Specified by:
      removeOutLink in interface INode
      Specified by:
      removeOutLink in interface ITimex
      Parameters:
      link - a new OUT link to remove from the set of outgoing links.
    • removeInLink

      public void removeInLink​(ILink link)
      Description copied from interface: ITimex
      Removes a TimeML link from the set of links that end in this node.
      Specified by:
      removeInLink in interface INode
      Specified by:
      removeInLink in interface ITimex
      Parameters:
      link - a new In link to remove from the set of incoming links.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toJSON

      public String toJSON()
      Description copied from interface: INode
      Returns the JSON (RFC 8259) representation of the Node.
      Specified by:
      toJSON in interface INode
      Returns:
      the JSON (RFC 8259) representation of the Node.
    • clone

      public Timex clone()
      Specified by:
      clone in interface INode