Class TimelineList<T>
- java.lang.Object
- 
- com.inductiveautomation.ignition.common.util.TimelineList<T>
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 - Direct Known Subclasses:
- Timeline
 
 public class TimelineList<T> extends java.lang.Object implements java.io.SerializableA timeline list is a list of values that cover a span of time. There is only one timeline, and so values cannot overlap. Items can be added with a start time, in which the end will be "forever", or a fixed range. In either case, the start and end may be adjusted (or the value overwritten) by new values that get added.- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classTimelineList.TimeSegmentA time segment covers a span of time.
 - 
Constructor SummaryConstructors Constructor Description TimelineList()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(long start, long end, T value)voidadd(long start, T value)Add the value at the given time, with a duration of forever.voidadd(TimelineList timelineList)voidadd(TimelineList.TimeSegment timeSegment)booleancovered(long time)Returns whether the timeline contains a segment that covers the specified time.Tget(long time)Returns the value for the specified time, or null if a value isn't defined.protected Tget(long time, boolean allowClosest, boolean allowRollover)TgetClosest(long time)Returns the value for the given time, or the next defined value.protected TimelineList.TimeSegmentgetSegment(int pos)TimelineList.TimeSegmentgetSegment(long time, boolean allowClosest)Returns the segment that contains the time.TimelineList.TimeSegmentgetSegment(long time, boolean allowClosest, boolean allowRollover)Returns the segment that contains the time.java.util.List<TimelineList.TimeSegment>getSegments()protected intindexOf(long time, boolean allowRollover)Returns the index of the segment that covers the time, or comes next after the time.voidmergeSegments()Merges together contiguous segments with the same value.longnextEvent(long time)Returns the next time that something interesting happens after the given time.longnextEvent(long time, boolean allowRollover)intsize()voidsort()java.lang.StringtoString()
 
- 
- 
- 
Method Detail- 
sizepublic int size() 
 - 
sortpublic void sort() 
 - 
indexOfprotected int indexOf(long time, boolean allowRollover)Returns the index of the segment that covers the time, or comes next after the time.- Parameters:
- allowRollover- if the time is beyond the last segment, and this parameter is true, the first index will be returned. Otherwise the last index of the list will be returned.
- Returns:
- the index of the segment that covers the time, or comes next after the time.
 
 - 
getSegmentprotected TimelineList.TimeSegment getSegment(int pos) 
 - 
addpublic void add(long start, T value)Add the value at the given time, with a duration of forever. Some care should be taken when using this function, because if values do not arrive in ascending time, previous entries will be overwritten. Because of this behavior, this function can also check the equality of values and avoid making extra segments, improving performance.
 - 
addpublic void add(long start, long end, T value)
 - 
addpublic void add(TimelineList.TimeSegment timeSegment) 
 - 
addpublic void add(TimelineList timelineList) 
 - 
coveredpublic boolean covered(long time) Returns whether the timeline contains a segment that covers the specified time.
 - 
getpublic T get(long time) Returns the value for the specified time, or null if a value isn't defined.
 - 
getClosestpublic T getClosest(long time) 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.
 - 
getprotected T get(long time, boolean allowClosest, boolean allowRollover) 
 - 
getSegmentpublic TimelineList.TimeSegment getSegment(long time, boolean allowClosest) 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.
 - 
getSegmentpublic TimelineList.TimeSegment getSegment(long time, boolean allowClosest, boolean allowRollover) 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.
 - 
nextEventpublic long nextEvent(long time) 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.
 - 
nextEventpublic long nextEvent(long time, boolean allowRollover)
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
getSegmentspublic java.util.List<TimelineList.TimeSegment> getSegments() 
 - 
mergeSegmentspublic void mergeSegments() Merges together contiguous segments with the same value. Used for composite user schedules.
 
- 
 
-