Class TemporalUtils

java.lang.Object
org.opengis.cite.geomatics.time.TemporalUtils

public class TemporalUtils extends Object
Provides various utility methods that apply to representations of temporal objects.
See Also:
  • 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

      public static String temporalGeometricPrimitiveToString(TemporalGeometricPrimitive timeObj)
      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

      public static Period temporalExtent(TreeSet<TemporalGeometricPrimitive> tmSet)
      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

      public static Instant add(Instant instant, int amount, TemporalUnit unit)
      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

      public static List<Period> splitInterval(Period period, int size)
      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

      static String getDateTime(Instant instant)
      Reproduces the behavior of legacy Instant.getPosition().getDateTime().toString() calls. Note: time zone is not correctly handled.