Class Timeline
- java.lang.Object
-
- com.inductiveautomation.ignition.common.util.TimelineList<java.lang.Object>
-
- com.inductiveautomation.ignition.common.util.Timeline
-
- All Implemented Interfaces:
java.io.Serializable
public class Timeline extends TimelineList<java.lang.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, useTimelineList
.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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Timeline.BaseParser
protected static class
Timeline.CalandarParser
static interface
Timeline.TimelineParser
static class
Timeline.TimelineStyle
protected static class
Timeline.TimeOfDayParser
-
Nested classes/interfaces inherited from class com.inductiveautomation.ignition.common.util.TimelineList
TimelineList.TimeSegment
-
-
Field Summary
Fields Modifier and Type Field Description protected Timeline.TimelineStyle
style
-
Constructor Summary
Constructors Constructor Description Timeline()
Timeline(Timeline.TimelineStyle style)
Specifies the style of timeline that this is (in other words, what the times represent).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSegment(long start, long end)
Adds a segment for the specified start and end times.static Timeline.TimelineParser
createParser(Timeline.TimelineStyle style)
java.lang.Object
getClosest(long time)
Returns the value for the given time, or the next defined value.TimelineList.TimeSegment
getSegment(long time, boolean allowClosest)
Returns the segment that contains the time.Timeline.TimelineStyle
getStyle()
Returns the style defined for this timelineTimeline
invert()
Returns a timeline whose elements cover the inverse of the source timeline.long
nextEvent(long time)
Returns the next time that something interesting happens after the given time.-
Methods inherited from class com.inductiveautomation.ignition.common.util.TimelineList
add, add, add, add, covered, get, get, getSegment, getSegment, getSegments, indexOf, mergeSegments, nextEvent, size, sort, toString
-
-
-
-
Field Detail
-
style
protected Timeline.TimelineStyle style
-
-
Constructor Detail
-
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 Detail
-
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 classTimelineList<java.lang.Object>
-
getClosest
public java.lang.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 classTimelineList<java.lang.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 classTimelineList<java.lang.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.
-
-