Class tstzspan
- All Implemented Interfaces:
Base,Collection,Time,TimeCollection,TemporalObject
``tstzspan`` objects can be created with a single argument of type string as in MobilityDB.
>>> new tstzspan("(2019-09-08 00:00:00+01, 2019-09-10 00:00:00+01)")
Another possibility is to provide the ``lower`` and ``upper`` named parameters (of type str or datetime), and optionally indicate whether the bounds are inclusive or exclusive (by default, the lower bound is inclusive and the upper is exclusive):
>>> new tstzspan(lower='2019-09-08 00:00:00+01', upper='2019-09-10 00:00:00+01') >>> new tstzspan(lower='2019-09-08 00:00:00+01', upper='2019-09-10 00:00:00+01', lower_inc=False, upper_inc=True) >>> new tstzspan(lower=parse('2019-09-08 00:00:00+01'), upper=parse('2019-09-10 00:00:00+01'), upper_inc=True)
- Author:
- ARIJIT SAMAL
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate jnr.ffi.Pointerprivate LocalDateTimeprivate static final Stringprivate static final Stringprivate booleanprivate LocalDateTimeprivate static final Stringprivate static final Stringprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptiontstzspan()The default constructorThe string constructorThe timestamps without bounds constructorThe timestamps and bounds constructortstzspan(String lower, LocalDateTime upper) The timestamps without bounds constructortstzspan(LocalDateTime lower, String upper) The timestamps without bounds constructortstzspan(LocalDateTime lower, LocalDateTime upper) The timestamps without bounds constructortstzspan(LocalDateTime lower, LocalDateTime upper, boolean lowerInclusive, boolean upperInclusive) The timestamps and bounds constructortstzspan(jnr.ffi.Pointer _inner) Constructor through Meos (C) inner objectConstructor by copy -
Method Summary
Modifier and TypeMethodDescriptionReturns the temporal union of "this" and "other".booleancontains(TemporalObject other) Returns whether "this" temporally contains "other".copy()Return a copy of "this" object.jnr.ffi.PointercreateInner(jnr.ffi.Pointer inner) jnr.ffi.PointercreateIntInt(Number lower, Number upper, boolean lower_inc, boolean upper_inc) jnr.ffi.PointercreateIntIntNb(Number lower, Number upper) jnr.ffi.PointercreateIntStr(Number lower, String upper, boolean lower_inc, boolean upper_inc) jnr.ffi.PointercreateStringInner(String str) jnr.ffi.PointercreateStrInt(String lower, Number upper, boolean lower_inc, boolean upper_inc) jnr.ffi.PointercreateStrStr(String lower, String upper, boolean lower_inc, boolean upper_inc) doubledistance(TemporalObject other) Returns the temporal distance between "this" and "other".duration()Returns the duration of the period.longReturns the duration of the period.booleanReturn whether "this" and "other" are equal.static tstzspanfrom_hexwkb(String hexwkb) Returns a tstzspan from its WKB representation in hex-encoded ASCII.jnr.ffi.PointerbooleangreaterThan(Time other) Return whether "this" is greater than "other".booleangreaterThanOrEqual(Time other) Return whether "this" is greater than or equal to "other".longhash()Return the hash representation of "this".intersection(TemporalObject other) Returns the temporal intersection of "this" and "other".booleanis_adjacent(TemporalObject other) Returns whether "this" is temporally adjacent to "other".booleanis_after(TemporalObject other) Returns whether "this" is strictly after "other".booleanis_before(TemporalObject other) Returns whether "this" is strictly before "other".booleanis_contained_in(TemporalObject other) Returns whether "this" is temporally contained in "container".booleanis_over_or_after(TemporalObject other) Returns whether "this" is after "other" allowing overlap.booleanis_over_or_before(TemporalObject other) Returns whether "this" is before "other" allowing overlap.booleanis_same(TemporalObject other) Returns whether "this" and the bounding period of "other" is the same.booleanReturn whether "this" is less than "other".booleanlessThanOrEqual(Time other) Return whether "this" is less than or equal to "other".lower()Returns the lower bound of a periodbooleanReturns whether the lower bound of the period is inclusive or notReturns the temporal difference of "this" and "other".Returns the temporal intersection of "this" and "other".booleanReturn whether "this" and "other" are not equal.booleanoverlaps(TemporalObject other) Returns whether "this" temporally overlaps "other".Returns the temporal difference of "this" and "other".Returns a period set containing "this" object.Returns a period set containing "this" object.toString()Return the string representation of the content of "this" object.Returns the temporal union of "this" and "other".upper()Returns the upper bound of a periodbooleanReturns whether the upper bound of the period is inclusive or notMethods inherited from class types.collections.base.Span
add, as_hexwkb, as_wkb, contains, copy, eq, from_hexwkb, from_wkb, greaterThan, greaterThanOrEqual, is_adjacent, is_contained_in, is_left, is_over_or_left, is_over_or_right, is_right, is_same, lessThan, lessThanOrEqual, minus, mul, notEquals, overlaps, to_spanset, union, widthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface types.collections.base.Collection
contains, is_contained_in, is_left, is_over_or_left, is_over_or_right, is_right, overlapsMethods inherited from interface types.collections.time.TimeCollection
is_after, is_before, is_over_or_after, is_over_or_before
-
Field Details
-
LOWER_INCLUSIVE
- See Also:
-
LOWER_EXCLUSIVE
- See Also:
-
UPPER_INCLUSIVE
- See Also:
-
UPPER_EXCLUSIVE
- See Also:
-
lower
-
upper
-
lowerInclusive
private boolean lowerInclusive -
upperInclusive
private boolean upperInclusive -
_inner
private jnr.ffi.Pointer _inner
-
-
Constructor Details
-
tstzspan
public tstzspan()The default constructor -
tstzspan
Constructor by copy- Parameters:
other- period instace
-
tstzspan
public tstzspan(jnr.ffi.Pointer _inner) Constructor through Meos (C) inner object- Parameters:
_inner- Pointer to C object
-
tstzspan
The string constructor- Parameters:
value- - a string with a tstzspan value
-
tstzspan
The timestamps without bounds constructor- Parameters:
lower- - a timestamp for the lower boundupper- - a timestamp for the upper bound
-
tstzspan
The timestamps and bounds constructor- Parameters:
lower- - a timestamp for the lower boundupper- - a timestamp for the upper boundlowerInclusive- - if the lower bound is inclusiveupperInclusive- - if the upper bound is inclusive
-
tstzspan
The timestamps without bounds constructor- Parameters:
lower- - a timestamp for the lower boundupper- - a timestamp for the upper bound
-
tstzspan
public tstzspan(LocalDateTime lower, LocalDateTime upper, boolean lowerInclusive, boolean upperInclusive) The timestamps and bounds constructor- Parameters:
lower- - a timestamp for the lower boundupper- - a timestamp for the upper boundlowerInclusive- - if the lower bound is inclusiveupperInclusive- - if the upper bound is inclusive
-
tstzspan
The timestamps without bounds constructor- Parameters:
lower- - a timestamp for the lower boundupper- - a timestamp for the upper bound
-
tstzspan
The timestamps without bounds constructor- Parameters:
lower- - a timestamp for the lower boundupper- - a timestamp for the upper bound
-
-
Method Details
-
createStringInner
- Specified by:
createStringInnerin classSpan<LocalDateTime>
-
createInner
public jnr.ffi.Pointer createInner(jnr.ffi.Pointer inner) - Specified by:
createInnerin classSpan<LocalDateTime>
-
createIntInt
public jnr.ffi.Pointer createIntInt(Number lower, Number upper, boolean lower_inc, boolean upper_inc) - Specified by:
createIntIntin classSpan<LocalDateTime>
-
createIntStr
public jnr.ffi.Pointer createIntStr(Number lower, String upper, boolean lower_inc, boolean upper_inc) - Specified by:
createIntStrin classSpan<LocalDateTime>
-
createStrStr
public jnr.ffi.Pointer createStrStr(String lower, String upper, boolean lower_inc, boolean upper_inc) - Specified by:
createStrStrin classSpan<LocalDateTime>
-
createStrInt
public jnr.ffi.Pointer createStrInt(String lower, Number upper, boolean lower_inc, boolean upper_inc) - Specified by:
createStrIntin classSpan<LocalDateTime>
-
createIntIntNb
- Specified by:
createIntIntNbin classSpan<LocalDateTime>
-
copy
Return a copy of "this" object.MEOS Functions:
- span_copy
- Returns:
- Instance of tstzspan class
-
from_hexwkb
Returns a tstzspan from its WKB representation in hex-encoded ASCII.MEOS Functions:
- span_from_hexwkb
- Parameters:
hexwkb- : WKB representation in hex-encoded ASCII- Returns:
- Instance of tstzspan class
-
toString
Return the string representation of the content of "this" object.MEOS Functions:
- period_out
-
to_spanset
Returns a period set containing "this" object.MEOS Functions:
- span_to_spanset
- Returns:
- tstzspanset instance
-
to_periodset
Returns a period set containing "this" object.MEOS Functions:
- span_to_spanset
- Returns:
- tstzspanset instance
-
get_inner
public jnr.ffi.Pointer get_inner()- Specified by:
get_innerin classSpan<LocalDateTime>
-
lower_inc
public boolean lower_inc()Returns whether the lower bound of the period is inclusive or notMEOS Functions:
- span_lower_inc
- Overrides:
lower_incin classSpan<LocalDateTime>- Returns:
- true if the lower bound of the period is inclusive and false otherwise
-
upper_inc
public boolean upper_inc()Returns whether the upper bound of the period is inclusive or notMEOS Functions:
- span_upper_inc
- Overrides:
upper_incin classSpan<LocalDateTime>- Returns:
- True if the upper bound of the period is inclusive and False otherwise
-
lower
Returns the lower bound of a periodMEOS Functions:
- period_lower
- Specified by:
lowerin classSpan<LocalDateTime>- Returns:
- The lower bound of the period as a
LocalDateTime
-
upper
Returns the upper bound of a periodMEOS Functions:
- period_upper
- Specified by:
upperin classSpan<LocalDateTime>- Returns:
- The upper bound of the period as a
LocalDateTime
-
duration
Returns the duration of the period.MEOS Functions:
- period_duration
- Returns:
- timedelta instance representing the duration of the period
-
duration_in_second
public long duration_in_second()Returns the duration of the period.MEOS Functions:
- span_width
- Returns:
- a float representing the duration of the period in seconds
-
hash
public long hash()Return the hash representation of "this".MEOS Functions:
- span_hash
- Overrides:
hashin classSpan<LocalDateTime>- Returns:
- integer instance
-
is_adjacent
Returns whether "this" is temporally adjacent to "other". That is, they share a bound but only one of them contains it.Examples: >>> tstzspan('[2012-01-01, 2012-01-02)').is_adjacent(tstzspan('[2012-01-02, 2012-01-03]')) >>> True >>> tstzspan('[2012-01-01, 2012-01-02]').is_adjacent(tstzspan('[2012-01-02, 2012-01-03]')) >>> False # Both contain bound >>> tstzspan('[2012-01-01, 2012-01-02)').is_adjacent(tstzspan('(2012-01-02, 2012-01-03]')) >>> False # Neither contain boundMEOS Functions:- adjacent_span_span
- adjacent_span_spanset
- adjacent_period_timestamp
- adjacent_period_timestampset
- adjacent_period_temporal
- Parameters:
other- temporal object to compare with- Returns:
- true if adjacent, false otherwise
- Throws:
Exception
-
is_contained_in
Returns whether "this" is temporally contained in "container".Examples: >>> tstzspan('[2012-01-02, 2012-01-03]').is_contained_in(tstzspan('[2012-01-01, 2012-01-04]')) >>> True >>> tstzspan('(2012-01-01, 2012-01-02)').is_contained_in(tstzspan('[2012-01-01, 2012-01-02]')) >>> True >>> tstzspan('[2012-01-01, 2012-01-02]').is_contained_in(tstzspan('(2012-01-01, 2012-01-02)')) >>> FalseMEOS Functions:- contained_span_span
- contained_span_spanset
- contained_period_temporal
- Parameters:
other- temporal object to compare with- Returns:
- true if contained, false otherwise
- Throws:
Exception
-
contains
Returns whether "this" temporally contains "other".Examples: >>> tstzspan('[2012-01-01, 2012-01-04]').contains(tstzspan('[2012-01-02, 2012-01-03]')) >>> True >>> tstzspan('[2012-01-01, 2012-01-02]').contains(tstzspan('(2012-01-01, 2012-01-02)')) >>> True >>> tstzspan('(2012-01-01, 2012-01-02)').contains(tstzspan('[2012-01-01, 2012-01-02]')) >>> FalseMEOS Functions:- contains_span_span
- contains_span_spanset
- contains_period_timestamp
- contains_period_timestampset
- contains_period_temporal
- Parameters:
other- temporal object to compare with- Returns:
- true if contains, false otherwise
- Throws:
Exception
-
overlaps
Returns whether "this" temporally overlaps "other". That is, both share at least an instantExamples: >>> tstzspan('[2012-01-01, 2012-01-02]').overlaps(tstzspan('[2012-01-02, 2012-01-03]')) >>> True >>> tstzspan('[2012-01-01, 2012-01-02)').overlaps(tstzspan('[2012-01-02, 2012-01-03]')) >>> False >>> tstzspan('[2012-01-01, 2012-01-02)').overlaps(tstzspan('(2012-01-02, 2012-01-03]')) >>> FalseMEOS Functions:- overlaps_span_span
- overlaps_span_spanset
- overlaps_period_timestampset
- overlaps_period_temporal
- Parameters:
other- temporal object to compare with- Returns:
- true if overlaps, false otherwise
- Throws:
Exception
-
is_same
Returns whether "this" and the bounding period of "other" is the same.MEOS Functions:
- same_period_temporal
- Parameters:
other- temporal object to compare with- Returns:
- true if equal, false otherwise
- Throws:
Exception
-
is_before
Returns whether "this" is strictly before "other". That is, "this" ends before "other" starts.Examples: >>> tstzspan('[2012-01-01, 2012-01-02)').is_before(tstzspan('[2012-01-02, 2012-01-03]')) >>> True >>> tstzspan('[2012-01-01, 2012-01-02)').is_before(tstzspan('(2012-01-02, 2012-01-03]')) >>> True >>> tstzspan('[2012-01-01, 2012-01-02]').is_before(tstzspan('[2012-01-02, 2012-01-03]')) >>> FalseMEOS Functions:- left_span_span
- left_span_spanset
- before_period_timestamp
- before_period_timestampset
- before_period_temporal
- Parameters:
other- temporal object to compare with- Returns:
- true if before, false otherwise
- Throws:
Exception
-
is_over_or_before
Returns whether "this" is before "other" allowing overlap. That is, "this" ends before "other" ends (or at the same time).Examples: >>> tstzspan('[2012-01-01, 2012-01-02)').is_over_or_before(tstzspan('[2012-01-02, 2012-01-03]')) >>> True >>> tstzspan('[2012-01-01, 2012-01-02]').is_over_or_before(tstzspan('[2012-01-02, 2012-01-03]')) >>> True >>> tstzspan('[2012-01-03, 2012-01-05]').is_over_or_before(tstzspan('[2012-01-01, 2012-01-04]')) >>> FalseMEOS Functions:- overleft_span_span
- overleft_span_spanset
- overbefore_period_timestamp
- overbefore_period_timestampset
- overbefore_period_temporal
- Parameters:
other- temporal object to compare with- Returns:
- true if before, false otherwise
- Throws:
Exception
-
is_after
Returns whether "this" is strictly after "other". That is, "this" starts after "other" ends.Examples: >>> tstzspan('[2012-01-02, 2012-01-03]').is_after(tstzspan('[2012-01-01, 2012-01-02)')) >>> True >>> tstzspan('(2012-01-02, 2012-01-03]').is_after(tstzspan('[2012-01-01, 2012-01-02)')) >>> True >>> tstzspan('[2012-01-02, 2012-01-03]').is_after(tstzspan('[2012-01-01, 2012-01-02]')) >>> FalseMEOS Functions:- right_span_span
- right_span_spanset
- after_period_timestamp
- after_period_timestampset
- after_period_temporal
- Parameters:
other- temporal object to compare with- Returns:
- true if after, false otherwise
- Throws:
Exception
-
is_over_or_after
Returns whether "this" is after "other" allowing overlap. That is, "this" starts after "other" starts (or at the same time).Examples: >>> tstzspan('[2012-01-02, 2012-01-03]').is_over_or_after(tstzspan('[2012-01-01, 2012-01-02)')) >>> True >>> tstzspan('[2012-01-02, 2012-01-03]').is_over_or_after(tstzspan('[2012-01-01, 2012-01-02]')) >>> True >>> tstzspan('[2012-01-02, 2012-01-03]').is_over_or_after(tstzspan('[2012-01-01, 2012-01-03]')) >>> FalseMEOS Functions:- overright_span_span
- overright_span_spanset
- overafter_period_timestamp
- overafter_period_timestampset
- overafter_period_temporal
- Parameters:
other- temporal object to compare with- Returns:
- true if overlapping or after, false otherwise
- Throws:
Exception
-
distance
Returns the temporal distance between "this" and "other".MEOS Functions:
- distance_span_span
- distance_spanset_span
- distance_period_timestamp
- Parameters:
other- temporal object to compare with- Returns:
- a timedelta instance
- Throws:
Exception
-
intersection
Returns the temporal intersection of "this" and "other".MEOS Functions:
- intersection_span_span
- intersection_spanset_span
- intersection_period_timestamp
-
mul
Returns the temporal intersection of "this" and "other".MEOS Functions:
- intersection_span_span
- intersection_spanset_span
- intersection_period_timestamp
-
minus
Returns the temporal difference of "this" and "other".MEOS Functions:
- minus_period_timestamp
- minus_span_spanset
- minus_span_span
- Parameters:
other- temporal object to diff with- Returns:
tstzspansetinstance
-
sub
Returns the temporal difference of "this" and "other".MEOS Functions:
- minus_period_timestamp
- minus_span_spanset
- minus_span_span
- Parameters:
other- temporal object to diff with- Returns:
tstzspansetinstance
-
union
Returns the temporal union of "this" and "other".MEOS Functions:
- union_period_timestamp
- union_spanset_span
- union_span_span
- Parameters:
other- temporal object to merge with- Returns:
- a
tstzspansetinstance.
-
add
Returns the temporal union of "this" and "other".MEOS Functions:
- union_period_timestamp
- union_spanset_span
- union_span_span
- Parameters:
other- temporal object to merge with- Returns:
- a
tstzspansetinstance.
-
eq
Return whether "this" and "other" are equal. MEOS Functions:- span_eq
- Parameters:
other- temporal object to compare with- Returns:
- true if equal, false otherwise
-
notEquals
Return whether "this" and "other" are not equal.MEOS Functions:
- span_neq
- Parameters:
other- temporal object to compare with- Returns:
- true if not equal, false otherwise
-
lessThan
Return whether "this" is less than "other".MEOS Functions:
- span_lt
- Parameters:
other- temporal object to compare with- Returns:
- true if less than, false otherwise
- Throws:
OperationNotSupportedException
-
lessThanOrEqual
Return whether "this" is less than or equal to "other".MEOS Functions:
- span_le
- Parameters:
other- temporal object to compare with- Returns:
- true if less than or equal, false otherwise
- Throws:
OperationNotSupportedException
-
greaterThan
Return whether "this" is greater than "other".MEOS Functions:
- span_gt
- Parameters:
other- temporal object to compare with- Returns:
- true if greater than, false otherwise
- Throws:
OperationNotSupportedException
-
greaterThanOrEqual
Return whether "this" is greater than or equal to "other".MEOS Functions:
- span_ge
- Parameters:
other- temporal object to compare with- Returns:
- true if greater than or equal, false otherwise
- Throws:
OperationNotSupportedException
-