Time Series Database Cache Module by Automation Professionals
E-Mail Support

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

PropertyData TypeDescription
spansList<DateSpan>Underlying list of DateSpans. Operations on this list are unchecked.
priorityIntegerThe 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)
ArgumentData TypeDescription
arg0DateSpan
DateSpans
Subject datespan(s)
returnsvoidMerge 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)
ArgumentData TypeDescription
priorityIntegerPriority to which to convert subject spans
arg1DateSpan
DateSpans
Subject datespan(s)
returnsvoidMerge 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)
ArgumentData TypeDescription
arg0DateSpan
DateSpans
Subject datespan(s)
returnsbooleanTrue 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)
ArgumentData TypeDescription
arg0DateSpan
DateSpans
Subject datespan(s)
returnsbooleanTrue if any part of this composite datespans contains any part of the subject datespan or composite datespans.
timeline.isEmpty()
ArgumentData TypeDescription
returnsbooleanTrue if no time spans are present in the composite list.
timeline.outer()
ArgumentData TypeDescription
returnsDateSpanThe smallest Datespan that contains this entire composite datespans, or null/None if nothing present.
timeline.prioritize(priority)
ArgumentData TypeDescription
priorityIntegerPriority to filter/convert to
returnsvoidRemove any spans of higher (less important) priority and convert and merge the remainder at the given priority.
timeline.remove(arg0)
ArgumentData TypeDescription
arg0DateSpan
DateSpans
Subject datespan(s)
returnsvoidSubtract the subject datespan or composite datespans from this composite datespans, without regard for priorities, ignoring any fragments not present.