Class MovingFeatureBuilder

java.lang.Object
org.apache.sis.internal.feature.MovingFeatures
org.apache.sis.internal.storage.csv.MovingFeatureBuilder

final class MovingFeatureBuilder extends MovingFeatures
Builder of feature where the geometry is a trajectory and some property values may change with time.
Since:
0.8
Version:
1.1
  • Field Details

    • properties

      private final MovingFeatureBuilder.Period[] properties
      The properties having values that may change in time. May contain the values of arbitrary properties (e.g. as String instances), or may contain the coordinates of part of a trajectory as array of primitive type like float[]. Trajectories may be specified in many parts if for example, the different parts are given on different lines of a CSV file.
    • count

      private final int[] count
      Number of Property instances added for each index of the properties table.
    • tmin

      private long tmin
      Overall start and end time over all properties.
    • tmax

      private long tmax
      Overall start and end time over all properties.
  • Constructor Details

    • MovingFeatureBuilder

      public MovingFeatureBuilder(MovingFeatureBuilder share, int numProperties)
      Creates a new moving feature.
      Parameters:
      share - other builder that may share time vectors, or null if none.
      numProperties - maximal number of dynamic properties.
  • Method Details

    • addTimeRange

      public final void addTimeRange(long startTime, long endTime)
      Adds a time range. The minimal and maximal values will be used by storeTimeRange(String, String, AbstractFeature).
      Parameters:
      startTime - beginning in milliseconds since Java epoch of the period when the property value is valid.
      endTime - end in milliseconds since Java epoch of the period when the the property value is valid.
    • addValue

      public final void addValue(int index, long startTime, long endTime, Object value)
      Adds a dynamic property value. This method shall be invoked with time periods in chronological order.
      Parameters:
      index - the property index.
      startTime - beginning in milliseconds since Java epoch of the period when the property value is valid.
      endTime - end in milliseconds since Java epoch of the period when the the property value is valid.
      value - the property value which is valid during the given period.
    • storeTimeRange

      public final void storeTimeRange(String startTime, String endTime, AbstractFeature dest)
      Stores the start time and end time in the given feature.
      Parameters:
      startTime - name of the property where to store the start time.
      endTime - name of the property where to store the end time.
      dest - feature where to store the start time and end time.
    • storeAttribute

      public final <V> void storeAttribute(int index, AbstractAttribute<V> dest)
      Sets the values of the given attribute to the values collected by this MovingFeatures. This method sets also the "datetimes" characteristic.
      Type Parameters:
      V - the type of values in the given attribute.
      Parameters:
      index - index of the property for which values are desired.
      dest - attribute where to store the value.
    • storeGeometry

      public final <G> void storeGeometry(String featureName, int index, int dimension, Geometries<G> factory, AbstractAttribute<G> dest, Consumer<LogRecord> warningListener)
      Sets the geometry of the given attribute to the values collected by this MovingFeatures. This method sets also the "datetimes" characteristic.
      Type Parameters:
      G - the type of the geometry value.
      Parameters:
      featureName - the name of the feature containing the attribute to update, for logging purpose.
      index - index of the property for which geometry value is desired.
      dimension - number of dimensions for all coordinates.
      factory - the factory to use for creating the geometry object.
      dest - attribute where to store the geometry value.
      warningListener - where to report warnings. Implementation should set the source class name, source method name and logger name, then forward to a WarningListener.
    • equals

      private static boolean equals(Vector previous, Vector next, int dimension)
      Returns true if the last coordinate of the previous vector is equal to the first coordinate of the next vector.
      Parameters:
      previous - the previous vector.
      next - the next vector.
      dimension - number of dimension in each coordinate.