Package org.opengis.cite.geomatics.time
Class TemporalUtils
java.lang.Object
org.opengis.cite.geomatics.time.TemporalUtils
Provides various utility methods that apply to representations of temporal objects.
- See Also:
-
- "ISO 19108: Geographic information -- Temporal schema"
- Maintaining knowledge about temporal intervals
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Instant
add
(Instant instant, int amount, TemporalUnit unit) Returns a copy of the given instant with the specified amount added or subtracted.static void
assertTemporalRelation
(RelativePosition temporalRelation, TemporalGeometricPrimitive t1, TemporalGeometricPrimitive t2) Asserts that the first temporal primitive is related to the second one so as to satisfy the specified temporal relationship.(package private) static String
getDateTime
(Instant instant) Reproduces the behavior of legacyInstant.getPosition().getDateTime().toString()
calls.splitInterval
(Period period, int size) Splits a time period into the specified number of intervals.static Period
Determines the total temporal extent of a set of temporal primitives.static String
Produces a condensed string representation of the given temporal object.
-
Constructor Details
-
TemporalUtils
public TemporalUtils()
-
-
Method Details
-
assertTemporalRelation
public static void assertTemporalRelation(RelativePosition temporalRelation, TemporalGeometricPrimitive t1, TemporalGeometricPrimitive t2) Asserts that the first temporal primitive is related to the second one so as to satisfy the specified temporal relationship. There are 13 temporal relationships defined in ISO 19108:- Before
- After
- Begins
- Ends
- During
- Equals
- Contains
- Overlaps
- Meets
- OverlappedBy
- MetBy
- BegunBy
- EndedBy
- Parameters:
temporalRelation
- A RelativePosition instance that designates a temporal relationship.t1
- A temporal geometric primitive (instant or period).t2
- Another temporal geometric primitive.
-
temporalGeometricPrimitiveToString
Produces a condensed string representation of the given temporal object.- Parameters:
timeObj
- A temporal geometric primitive (instant or period).- Returns:
- A String that displays temporal position in accord with ISO 8601.
-
temporalExtent
Determines the total temporal extent of a set of temporal primitives. The actual interval is extended by one hour at each end to ensure it contains all temporal objects in the set.- Parameters:
tmSet
- An ordered set of TemporalGeometricPrimitive objects (instant or period); it cannot be empty.- Returns:
- A period that contains the set members.
-
add
Returns a copy of the given instant with the specified amount added or subtracted.- Parameters:
instant
- An instantaneous point in time.amount
- The amount to add (positive) or subtract (negative).unit
- The date-time unit of the amount.- Returns:
- A new Instant representing the resulting date-time value.
-
splitInterval
Splits a time period into the specified number of intervals. Each sub-interval will have approximately the same length.- Parameters:
period
- A temporal interval.size
- The number of sub-intervals.- Returns:
- A sequence of contiguous sub-intervals (i.e. interval n MEETS interval n+1).
-
getDateTime
Reproduces the behavior of legacyInstant.getPosition().getDateTime().toString()
calls. Note: time zone is not correctly handled.
-