java.lang.Object
com.inductiveautomation.ignition.common.util.TimelineList<Object>
com.inductiveautomation.ignition.common.util.Timeline
All Implemented Interfaces:
Serializable

public class Timeline extends TimelineList<Object>
A timeline is a simple list of time segments. It is used to determine coverage, and its segments do not contain values. If values should be associated with time, use TimelineList.

Note: this also overrides some functions to provide correct support for TimeOfDay style values (ie, times, not full dates). Specifically, that means that functions like getClosest, nextEvent, getSegment, will roll over to the earliest time if necessary. As a consequence, anyone calling these should note whether the return is earlier than the requested time, and accordingly adjust their calculations by 1 day.

See Also:
  • Field Details

  • Constructor Details

    • Timeline

      public Timeline()
    • Timeline

      public Timeline(Timeline.TimelineStyle style)
      Specifies the style of timeline that this is (in other words, what the times represent).
  • Method Details

    • getStyle

      public Timeline.TimelineStyle getStyle()
      Returns the style defined for this timeline
    • addSegment

      public void addSegment(long start, long end)
      Adds a segment for the specified start and end times.
    • getSegment

      public TimelineList.TimeSegment getSegment(long time, boolean allowClosest)
      Description copied from class: TimelineList
      Returns the segment that contains the time. If allowClosest is true, will return the next possible time, if a time segment doesn't cover the current time.
      Overrides:
      getSegment in class TimelineList<Object>
    • getClosest

      public Object getClosest(long time)
      Description copied from class: TimelineList
      Returns the value for the given time, or the next defined value. Returns null if there is no value specified at, or beyond, the given time.
      Overrides:
      getClosest in class TimelineList<Object>
    • nextEvent

      public long nextEvent(long time)
      Description copied from class: TimelineList
      Returns the next time that something interesting happens after the given time. That is, the current segment ends, the next one starts, etc. If nothing else happens, Long.Max is returned.
      Overrides:
      nextEvent in class TimelineList<Object>
    • createParser

      public static Timeline.TimelineParser createParser(Timeline.TimelineStyle style)
    • invert

      public Timeline invert()
      Returns a timeline whose elements cover the inverse of the source timeline.