Class Timeline
java.lang.Object
com.inductiveautomation.ignition.common.util.TimelineList<Object>
com.inductiveautomation.ignition.common.util.Timeline
- All Implemented Interfaces:
Serializable
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
protected static class
static interface
static enum
protected static class
Nested classes/interfaces inherited from class com.inductiveautomation.ignition.common.util.TimelineList
TimelineList.TimeSegment
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTimeline()
Timeline
(Timeline.TimelineStyle style) Specifies the style of timeline that this is (in other words, what the times represent). -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSegment
(long start, long end) Adds a segment for the specified start and end times.static Timeline.TimelineParser
getClosest
(long time) Returns the value for the given time, or the next defined value.getSegment
(long time, boolean allowClosest) Returns the segment that contains the time.getStyle()
Returns the style defined for this timelineinvert()
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 Details
-
style
-
-
Constructor Details
-
Timeline
public Timeline() -
Timeline
Specifies the style of timeline that this is (in other words, what the times represent).
-
-
Method Details
-
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
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<Object>
-
getClosest
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<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<Object>
-
createParser
-
invert
Returns a timeline whose elements cover the inverse of the source timeline.
-