Class TimeEncoding

All Implemented Interfaces:
Function<String,Instant>, ObjectConverter<String,Instant>

class TimeEncoding extends SurjectiveConverter<String,Instant>
Specifies how time is encoded in the CSV file. Time values are formatted as numbers of seconds or minutes since an epoch, except in the special case of ABSOLUTE encoding.
Since:
0.7
Version:
1.2
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final TimeEncoding
    Times are formatted as ISO dates.
    (package private) static final CommonCRS.Temporal
    The temporal coordinate reference system to use for ABSOLUTE time encoding.
    private final double
    Number of milliseconds between two consecutive integer values on the time axis.
    private final long
    Date of value zero on the time axis, in milliseconds since January 1st 1970 at midnight UTC.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TimeEncoding(org.opengis.referencing.datum.TemporalDatum datum, javax.measure.Unit<javax.measure.quantity.Time> unit)
    Creates a new time encoding.
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(String time)
    Returns the instant for the given string, which is usually a time elapsed since the CRS temporal origin.
    final Class<String>
    Returns the type of values to convert.
    final Class<Instant>
    Returns the type of converted values.
    (package private) final double
    toCRS(long time)
    Converts the given timestamp to the values used in the temporal coordinate reference system.

    Methods inherited from class org.apache.sis.internal.converter.SurjectiveConverter

    inverse, properties, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.function.Function

    andThen, compose
  • Field Details

    • DEFAULT

      static final CommonCRS.Temporal DEFAULT
      The temporal coordinate reference system to use for ABSOLUTE time encoding.
    • ABSOLUTE

      static final TimeEncoding ABSOLUTE
      Times are formatted as ISO dates.
    • origin

      private final long origin
      Date of value zero on the time axis, in milliseconds since January 1st 1970 at midnight UTC.
    • interval

      private final double interval
      Number of milliseconds between two consecutive integer values on the time axis.
  • Constructor Details

    • TimeEncoding

      TimeEncoding(org.opengis.referencing.datum.TemporalDatum datum, javax.measure.Unit<javax.measure.quantity.Time> unit)
      Creates a new time encoding.
  • Method Details

    • getSourceClass

      public final Class<String> getSourceClass()
      Returns the type of values to convert.
      Returns:
      the type of objects to convert.
    • getTargetClass

      public final Class<Instant> getTargetClass()
      Returns the type of converted values.
      Returns:
      the type of converted objects.
    • apply

      public Instant apply(String time)
      Returns the instant for the given string, which is usually a time elapsed since the CRS temporal origin.
      Parameters:
      time - the string representation of the time to parse, often as a number since the CRS temporal origin.
      Returns:
      the instant parsed from the given string.
    • toCRS

      final double toCRS(long time)
      Converts the given timestamp to the values used in the temporal coordinate reference system.
      Parameters:
      time - number of milliseconds elapsed since January 1st, 1970 midnight UTC.
      Returns:
      the value to use with the temporal coordinate reference system.