DateSpans
This composite type describes an ordered sequence of non-overlapping
time spans, in the form of a list of DateSpan objects. The earliest
DateSpan may have a null start timestamp, and the latest DateSpan may
have a null end timestamp, each indicating "unbounded" in that
direction. A variety of comparison operations, composite operations, and
modification operations are supplied as methods. Prioritization is
maintained.
Syntax
from java.util import Date
from com.automation_pros.tsdbcache import DateSpan, DateSpans
timeline = DateSpans()
timeline.add(DateSpan(Date(...), Date(...)))
timeline.add(PrioDateSpan.make(priority, Date(...), Date(...)))
Properties
Property | Data Type | Description |
spans | List<DateSpan> | Underlying list of
DateSpans. Operations on this list are unchecked. |
priority | Integer | The numerically lowest
priority value (most important) present in the list of spans, or
Integer.MAX_VALUE if no spans are present. |
Methods
timeline.add(arg0) |
Argument | Data Type | Description |
arg0 | DateSpan DateSpans | Subject datespan(s) |
returns | void | Merge the subject datespan or
composite datespans into this composite datespans. Merge overlapping
or abutting spans of the same priority. Clip spans that overlap with
more important spans (lower priority value). |
timeline.add(priority, arg1) |
Argument | Data Type | Description |
priority | Integer | Priority to which to convert subject spans |
arg1 | DateSpan DateSpans | Subject datespan(s) |
returns | void | Merge the subject datespan or
composite datespans, at the given priority, into this composite
datespans. Merge overlapping or abutting spans of the same priority.
Clip spans that overlap with more important spans (lower priority
value). |
timeline.covers(arg0) |
Argument | Data Type | Description |
arg0 | DateSpan DateSpans | Subject datespan(s) |
returns | boolean | True if this
composite datespans is equal to or is a superset of the subject
datespan or composite datespans, without regard to priority. |
timeline.intersect(arg0) |
Argument | Data Type | Description |
arg0 | DateSpan DateSpans | Subject datespan(s) |
returns | boolean | True if any part of this
composite datespans contains any part of the subject datespan
or composite datespans. |
timeline.isEmpty() |
Argument | Data Type | Description |
returns | boolean | True if no time spans
are present in the composite list. |
timeline.outer() |
Argument | Data Type | Description |
returns | DateSpan | The smallest Datespan that
contains this entire composite datespans, or null/None if nothing
present. |
timeline.prioritize(priority) |
Argument | Data Type | Description |
priority | Integer | Priority to filter/convert to |
returns | void | Remove any spans of higher
(less important) priority and convert and merge the remainder at the
given priority. |
timeline.remove(arg0) |
Argument | Data Type | Description |
arg0 | DateSpan DateSpans | Subject datespan(s) |
returns | void | Subtract the subject datespan or
composite datespans from this composite datespans, without regard for
priorities, ignoring any fragments not present. |