Record Class AggregatedDataPoint<V, A extends AggregationType>

java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.data.AggregatedDataPoint<V,A>
Type Parameters:
V - the value type.
A - the aggregation type.
All Implemented Interfaces:
AggregatedPoint<V,A>, DataPoint<V>, SnapshotCapable, TemporalPoint<V, DataPointType>, Comparable<TemporalPoint<V, DataPointType>>

public record AggregatedDataPoint<V, A extends AggregationType>(V value, QualityCode quality, Instant timestamp, QualifiedPath source, A extends AggregationType aggregationType, Optional<Instant> snapshotTimestamp, Optional<WindowExtent> extent) extends Record implements AggregatedPoint<V,A>
A data point holding an aggregate value, with its aggregation type and an optional WindowExtent. A null quality defaults to QualityCode.Good and a null timestamp to now.
  • Constructor Details

  • Method Details

    • builder

      public static <V, A extends AggregationType> AggregatedDataPoint.Builder<V,A> builder(QualifiedPath source, A aggregationType)
      Creates a builder.
      Type Parameters:
      V - the value type.
      A - the aggregation type.
      Parameters:
      source - the source; must not be null.
      aggregationType - the aggregation; must not be null.
      Returns:
      a new builder.
    • from

      public static <V, A extends AggregationType> AggregatedDataPoint<V,A> from(DataPoint<V> point, A aggregationType)
      Creates an aggregated point from an existing data point.
      Type Parameters:
      V - the value type.
      A - the aggregation type.
      Parameters:
      point - the data point; must not be null.
      aggregationType - the aggregation; must not be null.
      Returns:
      the new point.
    • withSnapshot

      public AggregatedDataPoint<V,A> withSnapshot(Instant snapshotTime)
      Returns a copy with a different snapshot timestamp.
      Specified by:
      withSnapshot in interface SnapshotCapable
      Parameters:
      snapshotTime - the new snapshot timestamp; must not be null.
      Returns:
      the new point.
    • withExtent

      public AggregatedDataPoint<V,A> withExtent(@Nullable WindowExtent extent)
      Returns a copy carrying the first and last stored samples of its window.
      Parameters:
      extent - the extent, or null for none.
      Returns:
      the new point.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      public V value()
      Returns the value of the value record component.
      Specified by:
      value in interface DataPoint<V>
      Specified by:
      value in interface TemporalPoint<V, A extends AggregationType>
      Returns:
      the value of the value record component
    • quality

      public QualityCode quality()
      Returns the value of the quality record component.
      Specified by:
      quality in interface DataPoint<V>
      Returns:
      the value of the quality record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Specified by:
      timestamp in interface TemporalPoint<V, A extends AggregationType>
      Returns:
      the value of the timestamp record component
    • source

      public QualifiedPath source()
      Returns the value of the source record component.
      Specified by:
      source in interface TemporalPoint<V, A extends AggregationType>
      Returns:
      the value of the source record component
    • aggregationType

      public A aggregationType()
      Returns the value of the aggregationType record component.
      Specified by:
      aggregationType in interface AggregatedPoint<V, A extends AggregationType>
      Returns:
      the value of the aggregationType record component
    • snapshotTimestamp

      public Optional<Instant> snapshotTimestamp()
      Returns the value of the snapshotTimestamp record component.
      Specified by:
      snapshotTimestamp in interface SnapshotCapable
      Returns:
      the value of the snapshotTimestamp record component
    • extent

      public Optional<WindowExtent> extent()
      Returns the value of the extent record component.
      Specified by:
      extent in interface AggregatedPoint<V, A extends AggregationType>
      Returns:
      the value of the extent record component