Class TBox
- All Implemented Interfaces:
Box,TemporalObject
``TBox`` objects can be created with a single argument of type string as in MobilityDB.
>>> TBox('TBOXINT XT([0, 10),[2020-06-01, 2020-06-05])')
>>> TBox('TBOXFLOAT XT([0, 10),[2020-06-01, 2020-06-05])')
>>> TBox('TBOX T([2020-06-01, 2020-06-05])')
Another possibility is to provide the ``xmin``/``xmax`` (of type str or
int/float) and ``tmin``/``tmax`` (of type str or datetime) named parameters,
and optionally indicate whether the bounds are inclusive or exclusive (by
default, lower bounds are inclusive and upper bounds are exclusive):
>>> TBox(xmin=0, xmax=10, tmin='2020-06-01', tmax='2020-06-0')
>>> TBox(xmin=0, xmax=10, tmin='2020-06-01', tmax='2020-06-0', xmax_inc=True, tmax_inc=True)
>>> TBox(xmin='0', xmax='10', tmin=parse('2020-06-01'), tmax=parse('2020-06-0'))
Note that you can create a TBox with only the numerical or the temporal dimension. In these cases, it will be
equivalent to a tstzset (if it only has temporal dimension) or to a
floatrange (if it only has the numeric dimension).- Author:
- ARIJIT SAMAL
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTBox()------------------------- Constructors ----------------------------------Constructor with number parametersTBox(Number xmin, Number xmax, LocalDateTime tmin, LocalDateTime tmax) Constructor with number and temporal parametersTBox(Number xmin, Number xmax, LocalDateTime tmin, LocalDateTime tmax, boolean xmin_inc, boolean xmax_inc, boolean tmin_inc, boolean tmax_inc) Constructor with number, temporal and inclusions parametersThe string constructorTBox(jnr.ffi.Pointer inner) TBox(jnr.ffi.Pointer inner, boolean xmin_inc, boolean xmax_inc, boolean tmax_inc, boolean tmin_inc) -
Method Summary
Modifier and TypeMethodDescriptionReturns the union of "this" with "other".booleanReturns whether "this" temporally contains "other".copy()Returns a copy of "this".booleanReturns whether "this" is equal to "other".Returns the result of expanding "this" with the "other".static TBoxfrom_hexwkb(String hexwkb) Returns a "TBox" from its WKB representation in hex-encoded ASCII.static TBoxReturns a "TBox" from aTimeclass.static TBoxfrom_tnumber(TNumber temporal) Returns a "TBox" from aTNumberobject.static TBoxfrom_value_number(Number value) static TBoxfrom_value_span(Span span) Returns a "TBox" from a numeric value or span.static TBoxfrom_value_time(Object value, Object time) Returns a "TBox" from a numerical and a temporal object.jnr.ffi.PointerbooleanbooleanbooleangreaterThan(Box other) Returns whether "this" is greater than "other".booleangreaterThanOrEqual(Box other) Returns whether "this" is greater than or equal to "other".booleanhas_t()Returns whether "this" has a temporal dimension.booleanhas_x()Returns whether "this" has a numeric dimension.intersection(TBox other) Returns the intersection of "this" with "other".booleanis_adjacent_tbox(Object other) Returns whether "this" is adjacent to "other".booleanReturns whether "this" is strictly after "other".booleanReturns whether "this" is strictly before "other".booleanis_contained_in(Object other) Returns whether "this" is contained in "other".booleanis_float()Returns the distance between the nearest points of "this" and "other".booleanReturns whether "this" is strictly to the left of "other".booleanis_over_or_after(Object other) Returns whether "this" is after "other" allowing overlap.booleanis_over_or_before(Object other) Returns whether "this" is before "other" allowing overlap.booleanis_over_or_left(Object other) Returns whether "this" is to the left of "other" allowing overlap.booleanis_over_or_right(Object other) Returns whether "this" is to the right of "other" allowing overlap.booleanReturns whether "this" is strictly to the right of "other".booleanReturns whether "this" is the same as "other".booleanReturns whether "this" is less than "other".booleanlessThanOrEqual(Box other) Returns whether "this" is less than or equal to "other".Returns the intersection of "this" with "other".floatnearest_approach_distance(Object other) booleanReturns whether "this" is not equal to "other".booleanReturns whether "this" overlaps "other".round()Returns "this" rounded to the given number of decimal digits.round(int maxdd) Returns "this" rounded to the given number of decimal digits.Returns the numeric span of "this".Returns the temporal span of "this".toString()Returns a string representation of "this".toString(int max_decimals) Returns a string representation of "this".Returns the union of "this" with "other".
-
Field Details
-
xmin_inc
private boolean xmin_inc -
xmax_inc
private boolean xmax_inc -
tmin_inc
private boolean tmin_inc -
tmax_inc
private boolean tmax_inc -
_inner
private jnr.ffi.Pointer _inner
-
-
Constructor Details
-
TBox
public TBox()------------------------- Constructors ---------------------------------- -
TBox
public TBox(jnr.ffi.Pointer inner) -
TBox
public TBox(jnr.ffi.Pointer inner, boolean xmin_inc, boolean xmax_inc, boolean tmax_inc, boolean tmin_inc) -
TBox
The string constructor- Parameters:
value- - the string with the TBox value
-
TBox
Constructor with number parameters- Parameters:
xmin- X minimal coordinatesxmax- X maximal coordinates
-
TBox
Constructor with number and temporal parameters- Parameters:
xmin- X minimal coordinatesxmax- X maximal coordinatestmin- temporal minimal valuetmax- temporal maximal value
-
TBox
public TBox(Number xmin, Number xmax, LocalDateTime tmin, LocalDateTime tmax, boolean xmin_inc, boolean xmax_inc, boolean tmin_inc, boolean tmax_inc) Constructor with number, temporal and inclusions parameters- Parameters:
xmin- X minimal coordinatesxmax- X maximal coordinatestmin- temporal minimal valuetmax- temporal maximal valuexmin_inc- x minimal inclusionxmax_inc- x maximal inclusiontmin_inc- temporal minimal inclusiontmax_inc- temporal maxmimal inclusion
-
-
Method Details
-
copy
Returns a copy of "this".MEOS Functions:
- tbox_copy
- Returns:
- a new TBox instance
-
from_hexwkb
Returns a "TBox" from its WKB representation in hex-encoded ASCII.MEOS Functions:
- tbox_from_hexwkb
- Parameters:
hexwkb- WKB representation in hex-encoded ASCII- Returns:
- a new TBox instance
-
from_value_number
-
from_value_span
Returns a "TBox" from a numeric value or span. The created "TBox" will only have a numerical dimension.MEOS Functions:
- int_to_tbox
- float_to_tbox
- span_to_tbox
- span_to_tbox
- Parameters:
span- value to be canverted into a TBox- Returns:
- A new
TBoxinstance
-
from_time
Returns a "TBox" from aTimeclass. The created "TBox" will only have a temporal dimension.MEOS Functions:
- timestamp_to_tbox
- timestampset_to_tbox
- period_to_tbox
- periodset_to_tbox
-
from_value_time
Returns a "TBox" from a numerical and a temporal object.MEOS Functions:
- int_timestamp_to_tbox
- int_period_to_tbox
- float_timestamp_to_tbox
- float_period_to_tbox
- span_timestamp_to_tbox
- span_period_to_tbox
- Parameters:
value- numerical span of the TBoxtime- temporal span of the TBox- Returns:
- A new
TBoxinstance
-
from_tnumber
- Parameters:
temporal- temporal number to be canverted into a TBox- Returns:
- A new
TBoxinstance
-
toString
Returns a string representation of "this".MEOS Functions:
- tbox_out
-
toString
Returns a string representation of "this".MEOS Functions:
- tbox_out
- Parameters:
max_decimals- number of maximal decimals- Returns:
- a String instance
-
to_floatspan
Returns the numeric span of "this".MEOS Functions:
- tbox_to_floatspan
- Returns:
- A new
FloatSpaninstance
-
to_period
Returns the temporal span of "this".MEOS Functions:
- tbox_to_period
-
has_x
public boolean has_x()Returns whether "this" has a numeric dimension.MEOS Functions:
- tbox_hasx
- Returns:
- True if "this" has a numeric dimension, False otherwise
-
has_t
public boolean has_t()Returns whether "this" has a temporal dimension.MEOS Functions:
- tbox_hast
- Returns:
- True if "this" has a temporal dimension, False otherwise
-
expand
Returns the result of expanding "this" with the "other". Depending on the type of "other", the expansion will be of the numeric dimension (Float) or both (TBox).MEOS Functions:
- tbox_copy
- tbox_expand
- tbox_expand_value
- tbox_expand_time
- Parameters:
obj- object used to expand "this"- Returns:
- a
TBoxinstance
-
round
Returns "this" rounded to the given number of decimal digits.MEOS Functions:
- tbox_round
- Returns:
- a
instance
-
round
Returns "this" rounded to the given number of decimal digits.MEOS Functions:
- tbox_round
- Parameters:
maxdd- maximum number of decimal digits- Returns:
- a
instance
-
is_adjacent_tbox
Returns whether "this" is adjacent to "other". That is, they share only the temporal or numerical bound and only one of them contains it.Examples: >>> TBox('TBoxInt XT([0, 1], [2012-01-01, 2012-01-02))').is_adjacent(TBox('TBoxInt XT([0, 1], [2012-01-02, 2012-01-03])')) >>> True >>> TBox('TBoxInt XT([0, 1], [2012-01-01, 2012-01-02])').is_adjacent(TBox('TBoxInt XT([0, 1], [2012-01-02, 2012-01-03])')) >>> False # Both contain bound >>> TBox('TBoxInt XT([0, 1), [2012-01-01, 2012-01-02))').is_adjacent(TBox('TBoxInt XT([1, 2], [2012-01-02, 2012-01-03])') >>> False # Adjacent in both boundsMEOS Functions:
- adjacent_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- object to compare with- Returns:
- true if adjacent, false otherwise
-
is_contained_in
Returns whether "this" is contained in "other".Examples: >>> TBox('TBoxInt XT([1, 2], [2012-01-02, 2012-01-03])').is_contained_in(TBox('TBoxInt XT([1, 4], [2012-01-01, 2012-01-04])')) >>> True >>> TBox('TBoxFloat XT((1, 2), (2012-01-01, 2012-01-02))').is_contained_in(TBox('TBoxFloat XT([1, 4], [2012-01-01, 2012-01-02])')) >>> True >>> TBox('TBoxFloat XT([1, 2], [2012-01-01, 2012-01-02])').is_contained_in(TBox('TBoxFloat XT((1, 2), (2012-01-01, 2012-01-02))')) >>> FalseMEOS Functions:
- contained_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if contained, false otherwise
-
contains
Returns whether "this" temporally contains "other".Examples: >>> TBox('TBoxInt XT([1, 4], [2012-01-01, 2012-01-04]').contains(TBox('TBoxInt XT([2, 3], [2012-01-02, 2012-01-03]')) >>> True >>> TBox('TBoxFloat XT([1, 2], [2012-01-01, 2012-01-02]').contains(TBox('TBoxFloat XT((1, 2), (2012-01-01, 2012-01-02)')) >>> True >>> TBox('TBoxFloat XT((1, 2), (2012-01-01, 2012-01-02)').contains(TBox('TBoxFloat XT([1, 2], [2012-01-01, 2012-01-02]')) >>> FalseMEOS Functions:
- contains_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if contains, false otherwise
-
overlaps
Returns whether "this" overlaps "other". That is, both share at least an instant or a value.MEOS Functions:
- overlaps_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if overlaps, false otherwise
-
is_same
Returns whether "this" is the same as "other".MEOS Functions:
- same_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if same, false otherwise
-
is_left
Returns whether "this" is strictly to the left of "other".MEOS Functions:
- left_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- True if left, False otherwise
-
is_over_or_left
Returns whether "this" is to the left of "other" allowing overlap. That is, "this" does not extend to the right of "other".MEOS Functions:
- overleft_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if overleft, false otherwise
-
is_right
Returns whether "this" is strictly to the right of "other".MEOS Functions:
- right_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if right, false otherwise
-
is_over_or_right
Returns whether "this" is to the right of "other" allowing overlap. That is, "this" does not extend to the left of "other".MEOS Functions:
- overright_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- True if overright, False otherwise
-
is_before
Returns whether "this" is strictly before "other".MEOS Functions:
- before_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if before, false otherwise
-
is_over_or_before
Returns whether "this" is before "other" allowing overlap. That is, "this" does not extend after "other".MEOS Functions:
- overbefore_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if overbefore, false otherwise
-
is_after
Returns whether "this" is strictly after "other".MEOS Functions:
- after_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if after, false otherwise
-
is_over_or_after
Returns whether "this" is after "other" allowing overlap. That is, "this" does not extend before "other".MEOS Functions:
- overafter_tbox_tbox
- tnumber_to_tbox
- Parameters:
other- temporal object to compare with- Returns:
- true if overafter, false otherwise
-
union
Returns the union of "this" with "other". Fails if the union is not contiguous.MEOS Functions:
- union_tbox_tbox
- Parameters:
other- temporal object to merge with- Returns:
- a
TBoxinstance
-
add
Returns the union of "this" with "other". Fails if the union is not contiguous.MEOS Functions:
- union_tbox_tbox
- Parameters:
other- temporal object to merge with- Returns:
- a
TBoxinstance
-
intersection
Returns the intersection of "this" with "other".MEOS Functions:
- intersection_tbox_tbox
- Parameters:
other- temporal object to merge with- Returns:
- a
TBoxinstance if the instersection is not empty, "null" otherwise.
-
mul
Returns the intersection of "this" with "other".MEOS Functions:
- intersection_tbox_tbox
- Parameters:
other- temporal object to merge with- Returns:
- a
TBoxinstance if the instersection is not empty, "null" otherwise.
-
is_float
public boolean is_float()Returns the distance between the nearest points of "this" and "other".MEOS Functions:
- nad_tbox_tbox
- Returns:
- A
Floatwith the distance between the nearest points of "this" and "other".
-
nearest_approach_distance
-
eq
Returns whether "this" is equal to "other".MEOS Functions:
- tbox_eq
- Parameters:
other- temporal object to compare with- Returns:
- true if equal, false otherwise
-
notEquals
Returns whether "this" is not equal to "other".MEOS Functions:
- tbox_ne
- Parameters:
other- temporal object to compare with- Returns:
- true if not equal, false otherwise
-
lessThan
Returns whether "this" is less than "other". The time dimension is compared first, then the space dimension.
MEOS Functions:
- tbox_lt
- Parameters:
other- temporal object to compare with- Returns:
- true if less than, false otherwise
- Throws:
Exception
-
lessThanOrEqual
Returns whether "this" is less than or equal to "other". The time dimension is compared first, then the space dimension.MEOS Functions:
- tbox_le
- Parameters:
other- temporal object to compare with- Returns:
- true if less than or equal to, false otherwise
- Throws:
Exception
-
greaterThan
Returns whether "this" is greater than "other". The time dimension is compared first, then the space dimension.MEOS Functions:
- tbox_gt
- Parameters:
other- temporal object to compare with- Returns:
- true if greater than, false otherwise
- Throws:
Exception
-
greaterThanOrEqual
Returns whether "this" is greater than or equal to "other". The time dimension is compared first, then the space dimension.MEOS Functions:
- tbox_ge
- Parameters:
other- temporal object to compare with- Returns:
- true if greater than or equal to, false otherwise
- Throws:
Exception
-
get_tmin_inc
public boolean get_tmin_inc() -
get_tmax_inc
public boolean get_tmax_inc() -
get_inner
public jnr.ffi.Pointer get_inner()
-