DateSpan
This composite type describes a span of time based on an inclusive
start time and an exclusive end time. Either or both timestamps may be
null, indicating "unbounded" for that direction. A variety of comparison
operations and composite operations are supplied as methods.
Syntax
from java.util import Date
from com.automation_pros.tsdbcache import DateSpan
span = DateSpan(Date(...), Date(...))
Properties
Property | Data Type | Description |
start | Date | Beginning of time span, including this start point. |
end | Date | Ending of time span, excluding this end point. |
priority | Integer | Always equal to Integer.MAX_VALUE. |
Methods
DateSpan.dateToString(date) |
Argument | Data Type | Description |
date | Date | subject date |
returns | String | ISO 8601 formatted date, with milliseconds |
span.after(arg0) |
Argument | Data Type | Description |
arg0 | Date DateSpan DateSpans | Subject date |
returns | boolean | True if the datespan is after the subject
date or datespan or composite datespans. Note that a subject datespan will be
"after" if its start point is after or equal this datespan's end point. |
span.before(arg0) |
Argument | Data Type | Description |
arg0 | Date DateSpan DateSpans | Subject date |
returns | boolean | True if the datespan is before the subject
date or datespan or composite datespans. Note that a subject datespan will be
"before" if its end point is before or equal this datespan's start point. |
span.compareTo(arg0) |
Argument | Data Type | Description |
arg0 | DateSpan | Comparison subject |
returns | int | Implements natural ordering for
DateSpan objects, which will sort by ascending start point and
descending end point. |
span.contains(arg0) |
Argument | Data Type | Description |
arg0 | Date DateSpan DateSpans | Subject date |
returns | boolean | True if the datespan entirely
contains the subject date or datespan or composite datespans. Note that a
subject date must be before this datespan's end point, but a subject datespan
may also have a matching end point. |
span.inside(arg0) |
Argument | Data Type | Description |
arg0 | DateSpan | Subject datespan |
returns | boolean | True if the datespan is entirely
contained within the subject datespan. |
span.intersect(arg0) |
Argument | Data Type | Description |
arg0 | DateSpan DateSpans | Subject datespan(s) |
returns | boolean | True if any part of this datespan
contains any part of the subject datespan or composite datespans. |
span.outer(arg0) |
Argument | Data Type | Description |
arg0 | DateSpan | Subject datespan |
returns | DateSpan | The smallest Datespan that
contains both this span and the subject span. |
span.overlap(arg0) |
Argument | Data Type | Description |
arg0 | DateSpan | Subject datespan |
returns | DateSpan | The intersection of
of this span and the subject span, or null/None if no overlap. |