Class Temporal<V extends Serializable>
- Type Parameters:
V
- - Base type of the temporal data type eg. Integer, Boolean
- All Implemented Interfaces:
Serializable
,TemporalObject
- Direct Known Subclasses:
TInstant
,TSequence
,TSequenceSet
- Author:
- ARIJIT SAMAL
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Temporal
_factory
(jnr.ffi.Pointer inner, String customType, TemporalType temporalType) append_instant
(TInstant instant, float max_dist, Duration max_time) Returns a new :class:`Temporal` object equal to `self` with `instant` appended.append_sequence
(TSequence sequence) Returns a newTemporal
object equal to "this" with "sequence" appended.as_hexwkb
(jnr.ffi.Pointer wkb, long size) Returns the temporal object as a hex-encoded WKB string.Returns the temporal object as a MF-JSON string.Returns the temporal object as a MF-JSON string.jnr.ffi.Pointer
as_wkb()
Returns the temporal object as a hex-encoded WKB string.Returns a new temporal object with the values of "this" restricted to the time "other".at_max()
Returns a new temporal object containing the times "this" is at its maximum value.at_min()
Returns a new temporal object containing the times "this" is at its minimum value.Returns the bounding box of "this".static Duration
calculateDifference
(LocalDateTime start, LocalDateTime end) static Duration
calculateIntermediateDuration
(LocalDateTime start, LocalDateTime end, int n) boolean
contains
(TemporalObject other) Returns whether the bounding period of "this" contains the bounding period of "other".static long
convertToTimestamp
(LocalDateTime dateTime) Returns a list of temporal objects of the same subtype as `self` with the same values as `self` but split in n temporal tiles of equal duration.copy()
Returns a copy of the temporal object.private jnr.ffi.Pointer
createEmptyPointerArray
(jnr.ffi.Runtime runtime) Returns a list of temporal objects of the same subtype as `self` with the same values as `self` but split in temporal tiles of duration `duration` starting at `start`.abstract jnr.ffi.Pointer
createInner
(jnr.ffi.Pointer inner) private jnr.ffi.Pointer
createPointerArray
(List<?> temporalList) abstract jnr.ffi.Pointer
createStringInner
(String str) Returns a new :class:`Temporal` object equal to `self` with elements at `other` removed.duration
(boolean ignore_gaps) float
dyntimewarp_distance
(Temporal other) Returns the Dynamic Time Warp distance between "this" and "other".Returns the last instant in "this".Returns the last timestamp in "this".boolean
Returns whether "this" is equal to "other".float
frechet_distance
(Temporal other) Returns the Frechet distance between "this" and "other".from_hexwkb
(String str) Returns a temporal object from a hex-encoded WKB string.from_merge
(jnr.ffi.Pointer temporals) Returns a temporal object that is the result of merging the given temporal objects.from_merge_array
(List<Temporal> temporals) Returns a temporal object that is the result of merging the given temporal objects.from_wkb
(jnr.ffi.Pointer wkb, long size) Returns a temporal object from WKB bytes.abstract String
jnr.ffi.Pointer
getInner()
------------------------- Accessors ----------------------------------------abstract TemporalType
boolean
greaterThan
(Temporal other) Returns whether "this" is greater than "other".boolean
greaterThanOrEqual
(Temporal other) Returns whether "this" is greater or equal than "other".long
hash()
Returns the hash of the temporal object.float
hausdorff_distance
(Temporal other) Returns the Hausdorff distance between "this" and "other".Returns a newTemporal
object equal to "this" with "other" inserted.Returns a newTemporal
object equal to "this" with "other" inserted.instant_n
(int n) Returns the n-th instant in "this".instants()
Returns the instants in `self`.boolean
is_adjacent
(TemporalObject other) Returns whether the bounding box of "this" is adjacent to the bounding box of "other".boolean
is_after
(TemporalObject other) Returns whether "this" is after "other".boolean
is_before
(TemporalObject other) Returns whether "this" is before "other".boolean
is_contained_in
(TemporalObject other) Returns whether the bounding period of "this "is contained in the bounding period of "other".boolean
is_over_or_after
(TemporalObject other) Returns whether "this" is after "other" allowing overlap.boolean
is_over_or_before
(TemporalObject other) Returns whether "this" is before "other" allowing overlap.boolean
is_same
(TemporalObject other) Returns whether the bounding period of "this" is the same as the bounding period of "other".boolean
Returns whether the bounding period of "this" is temporally adjacent to the bounding period of "other".boolean
Returns whether the bounding period of "this" is contained in the bounding period of "other".boolean
Returns whether "this" is less than "other".boolean
lessThanOrEqual
(Temporal other) Returns whether "this" is less or equal than "other".Returns the instant in "this" with the maximum value.Returns a new :class:`Temporal` object that is the result of merging `self` with `other`.Returns the instant in "this" with the minimum value.Returns a new temporal object with the values of "this" removing those happening at "other".Returns a new temporal object containing the times "this" is not at its maximum value.Returns a new temporal object containing the times "this" is not at its minimum value.boolean
Returns whether "this" is not equal to "other".int
Returns the number of instants in "this".int
Returns the number of timestamps in "this".boolean
overlaps
(TemporalObject other) Returns whether the bounding period of "this" overlaps the bounding period of "other".period()
Returns thetstzset
on which "this" is defined ignoring potential time gaps.scale_time
(Duration duration) Returns a new :class:`Temporal` scaled so the temporal dimension has duration ``duration``.segments()
Returns the temporal segments in `self`.set_interpolation
(TInterpolation interpolation) Returns a newTemporal
object equal to "this" with the given interpolation.shift_scale_time
(Duration shift, Duration scale) Returns a new :class:`Temporal` with the time dimension shifted by ``shift`` and scaled so the temporal dimension has duration ``duration``.shift_time
(Duration duration) Returns a new :class:`Temporal` with the temporal dimension shifted by ``delta``.Returns the first instant in "this".Returns the first timestamp in "this".Return the subsequences where the objects stay within an area with a given maximum size for at least the specified duration.temporal_precision
(Object duration, Object start) Returns a new :class:`Temporal` with precision reduced to ``duration``.temporal_sample
(Object duration, Object start, TInterpolation interpolation) Returns a new :class:`Temporal` downsampled with respect to ``duration``.jnr.ffi.Pointer
temporal_simplify_dp
(jnr.ffi.Pointer temp, double dist, boolean sync) Return the simplified trip using Douglas-Peucker algorithmboolean
Returns whether the bounding period of "this" contains the bounding period of "other".boolean
Returns whether the bounding period of "this" overlaps the bounding period of "other".time()
Returns thetstzspanset
on which `self` is defined.time_split
(Object duration, Object start) time_split_n
(int n) timespan()
Returns thetstzspan
on which "this" is defined ignoring potential time gaps.timestamp_n
(int n) Returns the timestamps in `self`.static LocalDateTime
timestampToLocalDateTime
(int timestamp) Returns "this" as aTInstant
.to_sequence
(TInterpolation interpolation) Converts "this" into aTSequence
.to_sequenceset
(TInterpolation interpolation) Returns "this" as a newTSequenceSet
.tstzspan()
Returns a newTemporal
object equal to "this" updated with "other".Returns a newTemporal
object equal to "this" updated with "other".values()
Returns the list of values taken by `self`.
-
Field Details
-
inner
private jnr.ffi.Pointer inner
-
-
Constructor Details
-
Temporal
public Temporal()------------------------- Constructors ---------------------------------------- -
Temporal
-
Temporal
public Temporal(jnr.ffi.Pointer inner) -
Temporal
-
-
Method Details
-
createStringInner
-
createInner
public abstract jnr.ffi.Pointer createInner(jnr.ffi.Pointer inner) -
getCustomType
-
getTemporalType
-
_factory
public static Temporal _factory(jnr.ffi.Pointer inner, String customType, TemporalType temporalType) -
copy
Returns a copy of the temporal object.- Returns:
- a copy of the object
-
from_hexwkb
Returns a temporal object from a hex-encoded WKB string.MEOS Functions:
- temporal_from_hexwkb
- Parameters:
str
- The hex-encoded WKB string.- Returns:
- A temporal object from a hex-encoded WKB string.
-
from_wkb
Returns a temporal object from WKB bytes. Args: wkb: The WKB string. Returns: A temporal object from WKB bytes. MEOS Functions: temporal_from_wkb -
as_hexwkb
Returns the temporal object as a hex-encoded WKB string. Returns: The temporal object as a hex-encoded WKB string. MEOS Functions: temporal_as_hexwkb -
as_wkb
public jnr.ffi.Pointer as_wkb()Returns the temporal object as a hex-encoded WKB string. Returns: The temporal object as a hex-encoded WKB string. MEOS Functions: temporal_as_wkb -
as_mfjson
Returns the temporal object as a MF-JSON string.MEOS Functions:
- temporal_as_mfjson
- Parameters:
with_bbox
- Whether to include the bounding box in the output.flags
- The flags to use for the output.precision
- The precision to use for the output.srs
- The SRS to use for the output.- Returns:
- The temporal object as a MF-JSON string.
-
as_mfjson
Returns the temporal object as a MF-JSON string.MEOS Functions:
- temporal_as_mfjson
- Returns:
- The temporal object as a MF-JSON string.
-
from_merge
Returns a temporal object that is the result of merging the given temporal objects. Args: temporals: The temporal objects to merge. Returns: A temporal object that is the result of merging the given temporal objects. MEOS Functions: temporal_merge_array -
from_merge_array
Returns a temporal object that is the result of merging the given temporal objects. Args: temporals: The temporal objects to merge. Returns: A temporal object that is the result of merging the given temporal objects. -
getInner
public jnr.ffi.Pointer getInner()------------------------- Accessors ---------------------------------------- -
bounding_box
Returns the bounding box of "this".MEOS Functions:
- temporal_to_period
- Returns:
- The bounding box of `self`.
-
time
Returns thetstzspanset
on which `self` is defined. MEOS Functions: temporal_time- Returns:
- the
tstzspanset
on which `self` is defined.
-
interpolation
-
period
Returns thetstzset
on which "this" is defined ignoring potential time gaps.MEOS Functions:
- temporal_to_period
- Returns:
-
timespan
Returns thetstzspan
on which "this" is defined ignoring potential time gaps.MEOS Functions:
- temporal_to_period
- Returns:
-
num_instants
public int num_instants()Returns the number of instants in "this". MEOS Functions: temporal_num_instants- Returns:
- Returns the number of instants in "this".
-
start_instant
Returns the first instant in "this".MEOS Functions:
- temporal_start_instant
- Returns:
- Returns the first instant in "this".
-
end_instant
Returns the last instant in "this".MEOS Functions:
- temporal_end_instant
- Returns:
- Returns the last instant in "this".
-
min_instant
Returns the instant in "this" with the minimum value. If multiple instants have the minimum value, the first one is returned.MEOS Functions:
- temporal_min_instant
- Returns:
- Returns the instant in "this" with the minimum value.
-
max_instant
Returns the instant in "this" with the maximum value. If multiple instants have the maximum value, the first one is returned.MEOS Functions:
- temporal_max_instant
- Returns:
- Returns the instant in "this" with the maximum value.
-
instant_n
Returns the n-th instant in "this". (0-based)MEOS Functions:
- temporal_instant_n
- Parameters:
n
- instant- Returns:
- a new Temporal
-
duration
-
tstzspan
-
num_timestamps
public int num_timestamps()Returns the number of timestamps in "this".MEOS Functions:
- temporal_num_timestamps
- Returns:
- Returns the number of timestamps in "this".
-
start_timestamp
Returns the first timestamp in "this".MEOS Functions:
- temporal_start_timestamps
- Returns:
- Returns the first timestamp in "this".
-
end_timestamp
Returns the last timestamp in "this".MEOS Functions:
- temporal_end_timestamps
- Returns:
- Returns the last timestamp in "this".
-
timestampToLocalDateTime
-
timestamp_n
-
timestamps
Returns the timestamps in `self`. MEOS Functions: temporal_timestamps -
instants
Returns the instants in `self`. MEOS Functions: temporal_instants -
values
Returns the list of values taken by `self`. -
segments
Returns the temporal segments in `self`. MEOS Functions: temporal_segments -
hash
public long hash()Returns the hash of the temporal object.MEOS Functions:
- temporal_hash
- Returns:
- The hash of the temporal object.
-
set_interpolation
Returns a newTemporal
object equal to "this" with the given interpolation. MEOS Functions:- temporal_set_interpolation
- Parameters:
interpolation
- int value- Returns:
- Returns a new
Temporal
object equal to "this" with the given * interpolation.
-
shift_time
Returns a new :class:`Temporal` with the temporal dimension shifted by ``delta``. Args: delta: :class:`datetime.timedelta` instance to shift MEOS Functions: temporal_shift_time -
scale_time
Returns a new :class:`Temporal` scaled so the temporal dimension has duration ``duration``. Args: duration: :class:`datetime.timedelta` instance representing the duration of the new temporal MEOS Functions: temporal_scale_time -
shift_scale_time
Returns a new :class:`Temporal` with the time dimension shifted by ``shift`` and scaled so the temporal dimension has duration ``duration``. Args: shift: :class:`datetime.timedelta` instance to shift duration: :class:`datetime.timedelta` instance representing the duration of the new temporal MEOS Functions: temporal_shift_scale_time -
temporal_sample
Returns a new :class:`Temporal` downsampled with respect to ``duration``. Args: duration: A :class:`str` or :class:`timedelta` with the duration of the temporal tiles. start: A :class:`str` or :class:`datetime` with the start time of the temporal tiles. If None, the start time used by default is Monday, January 3, 2000. interpolation: Interpolation of the resulting temporal object. If None, defaults to the interpolation of ``self``. MEOS Functions: temporal_tsample -
temporal_precision
Returns a new :class:`Temporal` with precision reduced to ``duration``. Args: duration: A :class:`str` or :class:`timedelta` with the duration of the temporal tiles. start: A :class:`str` or :class:`datetime` with the start time of the temporal tiles. If None, the start time used by default is Monday, January 3, 2000. MEOS Functions: temporal_tprecision -
to_instant
- Returns:
- Returns "this" as a
TInstant
.
-
to_sequence
- Parameters:
interpolation
- int value- Returns:
- a new
TSequence
.
-
to_sequenceset
Returns "this" as a newTSequenceSet
. MEOS Functions:- temporal_to_tsequenceset
- Parameters:
interpolation
- int value- Returns:
- a new
TSequenceSet
-
toDataFrame
-
append_instant
Returns a new :class:`Temporal` object equal to `self` with `instant` appended. Args: instant: :class:`TInstant` to append max_dist: Maximum distance for defining a gap max_time: Maximum time for defining a gap MEOS Functions: temporal_append_tinstant -
append_sequence
Returns a newTemporal
object equal to "this" with "sequence" appended.MEOS Functions:
- temporal_append_tsequence
-
insert
Returns a newTemporal
object equal to "this" with "other" inserted.MEOS Functions:
- temporal_insert
-
createPointerArray
- Throws:
Exception
-
merge
Returns a new :class:`Temporal` object that is the result of merging `self` with `other`. MEOS Functions: temporal_merge, temporal_merge_array- Throws:
Exception
-
insert
Returns a newTemporal
object equal to "this" with "other" inserted.MEOS Functions:
- temporal_insert
-
update
-
update
-
delete
Returns a new :class:`Temporal` object equal to `self` with elements at `other` removed. Args: other: :class:`Time` object to remove from `self` connect: whether to connect the potential gaps generated by the deletions. MEOS Functions: temporal_update- Throws:
Exception
-
at
Returns a new temporal object with the values of "this" restricted to the time "other".MEOS Functions:
- temporal_at_timestamp
- temporal_at_timestampset
- temporal_at_period
- temporal_at_periodset
- Parameters:
other
- A time object to restrict the values of "this" to.- Returns:
- A new temporal object of the same subtype as `self`
-
at_min
Returns a new temporal object containing the times "this" is at its minimum value.MEOS Functions:
- temporal_at_min
- Returns:
- A new temporal object of the same subtype as `self`.
-
at_max
Returns a new temporal object containing the times "this" is at its maximum value.MEOS Functions:
- temporal_at_max
- Returns:
- A new temporal object of the same subtype as `self`.
-
minus
Returns a new temporal object with the values of "this" removing those happening at "other".MEOS Functions:
- temporal_minus_timestamp
- temporal_minus_timestampset
- temporal_minus_period
- temporal_minus_periodset
- Parameters:
other
- A time object to remove from "this".- Returns:
- A new temporal object of the same subtype as "this".
-
minus_min
Returns a new temporal object containing the times "this" is not at its minimum value.MEOS Functions:
- temporal_minus_min
- Returns:
- A new temporal object of the same subtype as "this".
-
minus_max
Returns a new temporal object containing the times "this" is not at its maximum value.MEOS Functions:
- temporal_minus_max
- Returns:
- A new temporal object of the same subtype as "this".
-
is_adjacent
Returns whether the bounding box of "this" is adjacent to the bounding box of "other". Temporal subclasses may override this method to provide more specific behavior related to their types a check adjacency over more dimensions.See Also:
Set.is_adjacent(Base)
- Parameters:
other
- A time or temporal object to compare to "this".- Returns:
- True if adjacent, False otherwise.
- Throws:
Exception
-
is_temporally_adjacent
Returns whether the bounding period of "this" is temporally adjacent to the bounding period of "other".See Also:
tstzset.is_adjacent(TemporalObject)
- Parameters:
other
- A time or temporal object to compare to "this".- Returns:
- True if adjacent, False otherwise.
- Throws:
Exception
-
is_contained_in
Returns whether the bounding period of "this "is contained in the bounding period of "other". Temporal subclasses may override this method to provide more specific behavior related to their typesSee Also:
tstzset.is_contained_in(TemporalObject)
- Parameters:
other
- A time or temporal object to compare to "this".- Returns:
- True if contained, False otherwise.
- Throws:
Exception
-
is_temporally_contained_in
Returns whether the bounding period of "this" is contained in the bounding period of "other".See Also:
tstzset.is_contained_in(TemporalObject)
- Parameters:
other
- A time or temporal object to compare to "this".- Returns:
- True if contained, False otherwise.
- Throws:
Exception
-
contains
Returns whether the bounding period of "this" contains the bounding period of "other". Temporal subclasses may override this method to provide more specific behavior related to their typesSee Also:
tstzset.contains(TemporalObject)
- Parameters:
other
- A time or temporal object to compare to "this".- Returns:
- True if contains, False otherwise.
- Throws:
Exception
-
temporally_contains
Returns whether the bounding period of "this" contains the bounding period of "other".See Also:
tstzset.contains(TemporalObject)
- Parameters:
other
- A time or temporal object to compare to "this".- Returns:
- True if contains, False otherwise.
- Throws:
Exception
-
overlaps
Returns whether the bounding period of "this" overlaps the bounding period of "other". Temporal subclasses may override this method to provide more specific behavior related to their typesSee Also:
tstzset.overlaps(TemporalObject)
- Parameters:
other
- A time or temporal object to compare to "this".- Returns:
- True if overlaps, False otherwise.
- Throws:
Exception
-
temporally_overlaps
Returns whether the bounding period of "this" overlaps the bounding period of "other".See Also:
tstzset.overlaps(TemporalObject)
- Parameters:
other
- A time or temporal object to compare to "this".- Returns:
- True if overlaps, False otherwise.
- Throws:
Exception
-
is_same
Returns whether the bounding period of "this" is the same as the bounding period of "other". Temporal subclasses may override this method to provide more specific behavior related to their typesSee Also:
tstzset.is_same(Time)
(TemporalObject)}- Parameters:
other
- A time or temporal object to compare to `self`.- Returns:
- True if same, False otherwise.
- Throws:
Exception
-
is_before
Returns whether "this" is before "other".See Also:
tstzset.is_before(TemporalObject)
- Parameters:
other
- A time or temporal object to compare "this" to.- Returns:
- True if "this" is before "other", False otherwise.
- Throws:
Exception
-
is_over_or_before
Returns whether "this" is before "other" allowing overlap. That is, "this" doesn't extend after "other".- Parameters:
other
- A time or temporal object to compare `self` to.- Returns:
- True if `self` is before `other` allowing overlap, False otherwise.
- Throws:
Exception
-
is_after
Returns whether "this" is after "other".See Also:
tstzset.is_after(TemporalObject)
- Parameters:
other
- A time or temporal object to compare "this" to.- Returns:
- True if "this" is after "other", False otherwise.
- Throws:
Exception
-
is_over_or_after
Returns whether "this" is after "other" allowing overlap. That is, "this" doesn't extend before "other".See Also:
tstzset.is_over_or_after(TemporalObject)
- Parameters:
other
- A time or temporal object to compare "this" to.- Returns:
- True if "this" is after "other" allowing overlap, False otherwise.
- Throws:
Exception
-
frechet_distance
Returns the Frechet distance between "this" and "other".MEOS Functions:
- temporal_frechet_distance
- Parameters:
other
- A temporal object to compare to "this".- Returns:
- A
Float
with the Frechet distance.
-
dyntimewarp_distance
Returns the Dynamic Time Warp distance between "this" and "other".MEOS Functions:
- temporal_dyntimewarp_distance
- Parameters:
other
- A temporal object to compare to "this".- Returns:
- A
Float
with the Dynamic Time Warp distance.
-
hausdorff_distance
Returns the Hausdorff distance between "this" and "other".MEOS Functions:
- temporal_hausdorff_distance
- Parameters:
other
- A temporal object to compare to "this".- Returns:
- A
Float
with the Hausdorff distance.
-
temporal_simplify_dp
public jnr.ffi.Pointer temporal_simplify_dp(jnr.ffi.Pointer temp, double dist, boolean sync) Return the simplified trip using Douglas-Peucker algorithm- Parameters:
temp
- Pointer objectdist
- distancesync
- synchronization- Returns:
- a new Pointer object
-
createEmptyPointerArray
private jnr.ffi.Pointer createEmptyPointerArray(jnr.ffi.Runtime runtime) Returns a list of temporal objects of the same subtype as `self` with the same values as `self` but split in temporal tiles of duration `duration` starting at `start`. Args: duration: A :class:`str` or :class:`timedelta` with the duration of the temporal tiles. start: A :class:`str` or :class:`datetime` with the start time of the temporal tiles. If None, the start time used by default is Monday, January 3, 2000. Returns: A list of temporal objects of the same subtype as `self`. MEOS Functions: temporal_time_split -
time_split
-
convertToTimestamp
Returns a list of temporal objects of the same subtype as `self` with the same values as `self` but split in n temporal tiles of equal duration. Args: n: An :class:`int` with the number of temporal tiles. Returns: A list of temporal objects of the same subtype as `self`. MEOS Functions: temporal_time_split -
calculateDifference
-
calculateIntermediateDuration
-
time_split_n
-
stops
Return the subsequences where the objects stay within an area with a given maximum size for at least the specified duration. Args: max_distance: A :class:`float` with the maximum distance of a stop. min_duration: A :class:`timedelta` with the minimum duration of a stop. Returns: A :class:`SequenceSet` of the same subtype as `self` with the stops. MEOS Functions: temporal_stops -
eq
Returns whether "this" is equal to "other".MEOS Functions: temporal_eq
- Parameters:
other
- A temporal object to compare to "this".- Returns:
- A
Boolean
with the result of the equality relation.
-
notEquals
Returns whether "this" is not equal to "other".MEOS Functions:
- temporal_ne
- Parameters:
other
- A temporal object to compare to "this".- Returns:
- A
Boolean
with the result of the not equal relation.
-
lessThan
Returns whether "this" is less than "other".MEOS Functions:
- temporal_lt
- Parameters:
other
- A temporal object to compare to "this".- Returns:
- A
Boolean
with the result of the less than relation.
-
lessThanOrEqual
Returns whether "this" is less or equal than "other".MEOS Functions:
- temporal_le
- Parameters:
other
- A temporal object to compare to "this".- Returns:
- A
Boolean
with the result of the less or equal than relation.
-
greaterThan
Returns whether "this" is greater than "other".MEOS Functions:
- temporal_gt
- Parameters:
other
- A temporal object to compare to "this".- Returns:
- A
Boolean
with the result of the greater than relation.
-
greaterThanOrEqual
Returns whether "this" is greater or equal than "other".MEOS Functions:
- temporal_ge
- Parameters:
other
- A temporal object to compare to "this".- Returns:
- A
Boolean
with the result of the greater or equal than * relation.
-