Class TimeMLTimeline

java.lang.Object
edu.fiu.jtlex.timeml.timeline.TimeMLTimeline
All Implemented Interfaces:
ITimeMLTimeline, Iterable<String>, Iterator<String>

public class TimeMLTimeline extends Object implements ITimeMLTimeline, Iterator<String>, Iterable<String>
Default implementation of ITimeline.
Since:
jTLEX 1.0
Author:
Emmanuel Garcia
  • Constructor Details

    • TimeMLTimeline

      public TimeMLTimeline(List<List<String>> Timeline, Set<ITimeMLLink> singleSlinks)
      Represents a Timeline of a TimeML graph, which is an ordered list of the events extracted from a TimeML Graph. TimeML annotations are converted into a collection of main and subordinated timelines arranged into a trunk-and-branch style structure. This class takes an ordered timeline, a set of attachment links, arranging them into a Timeline.
      Parameters:
      Timeline - produced by the Solve() method in the GraphTCSP.java class.
      singleSlinks - Set<ILink> produced by the partitionLinks() method in the Partitioner.java class.
      Throws:
      NullPointerException - if Timeline argument is null
  • Method Details

    • iterator

      public Iterator<String> iterator()
      Returns an iterator object that is used in for-each loops.
      Specified by:
      iterator in interface Iterable<String>
      Specified by:
      iterator in interface ITimeMLTimeline
      Returns:
      an iterator object that is used in for-each loops.
      Since:
      jTLEX 1.0
    • hasNext

      public boolean hasNext()
      Checks if there are Timeline elements remaining in the list.
      Specified by:
      hasNext in interface Iterator<String>
      Specified by:
      hasNext in interface ITimeMLTimeline
      Returns:
      true if there are Timeline elements remaining in the list.
      Since:
      jTLEX 1.0
    • next

      public String next() throws IndexOutOfBoundsException
      Returns next String representation of an event on the timeline.
      Specified by:
      next in interface Iterator<String>
      Specified by:
      next in interface ITimeMLTimeline
      Returns:
      next String representation of an event on the timeline.
      Throws:
      IndexOutOfBoundsException
      Since:
      jTLEX 1.0
    • getMainTimeline

      public List<String> getMainTimeline()
      Returns the List<String> representation of the main Timeline in the graph.
      Specified by:
      getMainTimeline in interface ITimeMLTimeline
      Returns:
      the List<String> representation of the main Timeline in the graph.
      Since:
      jTLEX 1.0
    • getSubordinationTimelines

      public List<List<String>> getSubordinationTimelines()
      Returns an ArrayList containing the Timelines belonging to the subordinating subgraphs.
      Specified by:
      getSubordinationTimelines in interface ITimeMLTimeline
      Returns:
      an ArrayList containing the Timelines belonging to the subordinating subgraphs.
      Since:
      jTLEX 1.0
    • getTotalTimePoints

      public int getTotalTimePoints()
      Returns number of timepoints.
      Specified by:
      getTotalTimePoints in interface ITimeMLTimeline
      Returns:
      the number of timepoints.
      Since:
      jTLEX 1.0
    • getAttachmentPoints

      public List<String> getAttachmentPoints()
      Returns a List containing the breaking points.
      Specified by:
      getAttachmentPoints in interface ITimeMLTimeline
      Returns:
      a List containing the breaking points.
      Since:
      jTLEX 1.0
    • getFirstPoint

      public String getFirstPoint()
      Returns the first timepoint in the Timeline.
      Specified by:
      getFirstPoint in interface ITimeMLTimeline
      Returns:
      the first timepoint in the Timeline.
      Since:
      jTLEX 1.0
    • getLastPoint

      public String getLastPoint()
      Returns the last timepoint in the Timeline.
      Specified by:
      getLastPoint in interface ITimeMLTimeline
      Returns:
      the last timepoint in the Timeline.
      Since:
      jTLEX 1.0
    • getTimelineLength

      public int getTimelineLength()
      Returns the number of events in the timeline.
      Specified by:
      getTimelineLength in interface ITimeMLTimeline
      Returns:
      the number of events in the timeline.
      Since:
      jTLEX 1.0
    • getTotalSubordinationBranches

      public int getTotalSubordinationBranches()
      Returns the total number of subordination branches in the graph.
      Specified by:
      getTotalSubordinationBranches in interface ITimeMLTimeline
      Returns:
      the total number of subordination branches in the graph.
      Since:
      jTLEX 1.0
    • toString

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

      public String toJson()
      Returns the JSON (RFC 8259) representation of the Timeline.
      Specified by:
      toJson in interface ITimeMLTimeline
      Returns:
      the JSON (RFC 8259) representation of the Timeline.
      Since:
      jTLEX 1.0
    • hashCode

      public int hashCode()
      Generates a hash code for the timeline.
      Specified by:
      hashCode in interface ITimeMLTimeline
      Overrides:
      hashCode in class Object
      Returns:
      The hash code.
      Since:
      jTLEX 1.0
    • equals

      public boolean equals(Object o)
      Checks if this Timeline equals an object.
      Specified by:
      equals in interface ITimeMLTimeline
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare against.
      Returns:
      True if timelines are equal, i.e. same mainTimeline and timelines, or else false.
      Throws:
      NullPointerException - If the object to compare against is false.
      Since:
      jTLEX 1.0