Record Class LongMoments

java.lang.Object
java.lang.Record
io.jenetics.stat.LongMoments
Record Components:
count - the count of values recorded
min - the minimum value recorded, or Long.MAX_VALUE if no values have been recorded
max - the maximum value recorded, or Long.MIN_VALUE if no values have been recorded
sum - the sum of values recorded, or zero if no values have been recorded
mean - the arithmetic mean of values recorded, or zero if no values have been recorded
variance - the variance of values recorded, or Double.NaN if no values have been recorded
skewness - the Skewness of values recorded, or Double.NaN if less than two values have been recorded
kurtosis - the Kurtosis of values recorded, or Double.NaN if less than four values have been recorded
All Implemented Interfaces:
Serializable

public record LongMoments(long count, long min, long max, long sum, double mean, double variance, double skewness, double kurtosis) extends Record implements Serializable
Value objects which contains statistical moments.
Since:
3.0
Version:
7.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    LongMoments(long count, long min, long max, long sum, double mean, double variance, double skewness, double kurtosis)
    Creates an instance of a LongMoments record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the value of the count record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the kurtosis record component.
    long
    max()
    Returns the value of the max record component.
    double
    Returns the value of the mean record component.
    long
    min()
    Returns the value of the min record component.
    Return a new value object of the statistical moments, currently represented by the statistics object.
    double
    Returns the value of the skewness record component.
    long
    sum()
    Returns the value of the sum record component.
    static <N extends Number>
    Collector<N,?,LongMoments>
    Return a Collector which returns moments-statistics for the resulting values.
    static <T> Collector<T,?,LongMoments>
    toLongMoments(ToLongFunction<? super T> mapper)
    Return a Collector which applies an long-producing mapping function to each input element, and returns moments-statistics for the resulting values.
    Returns a string representation of this record class.
    double
    Returns the value of the variance record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LongMoments

      public LongMoments(long count, long min, long max, long sum, double mean, double variance, double skewness, double kurtosis)
      Creates an instance of a LongMoments record class.
      Parameters:
      count - the value for the count record component
      min - the value for the min record component
      max - the value for the max record component
      sum - the value for the sum record component
      mean - the value for the mean record component
      variance - the value for the variance record component
      skewness - the value for the skewness record component
      kurtosis - the value for the kurtosis record component
  • Method Details

    • toString

      public 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
    • of

      public static LongMoments of(LongMomentStatistics statistics)
      Return a new value object of the statistical moments, currently represented by the statistics object.
      Parameters:
      statistics - the creating (mutable) statistics class
      Returns:
      the statistical moments
    • toLongMoments

      public static <N extends Number> Collector<N,?,LongMoments> toLongMoments()
      Return a Collector which returns moments-statistics for the resulting values.
      final Stream<Long> stream = ... final LongMoments moments = stream.collect(toLongMoments()));
      Type Parameters:
      N - the type of the input elements
      Returns:
      a Collector implementing the moments-statistics reduction
      Since:
      4.1
    • toLongMoments

      public static <T> Collector<T,?,LongMoments> toLongMoments(ToLongFunction<? super T> mapper)
      Return a Collector which applies an long-producing mapping function to each input element, and returns moments-statistics for the resulting values.
      final Stream<SomeObject> stream = ... final LongMoments moments = stream .collect(toLongMoments(v -> v.longValue()));
      Type Parameters:
      T - the type of the input elements
      Parameters:
      mapper - a mapping function to apply to each element
      Returns:
      a Collector implementing the moments-statistics reduction
      Throws:
      NullPointerException - if the given mapper is null
    • 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 '=='.
      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.
    • count

      public long count()
      Returns the value of the count record component.
      Returns:
      the value of the count record component
    • min

      public long min()
      Returns the value of the min record component.
      Returns:
      the value of the min record component
    • max

      public long max()
      Returns the value of the max record component.
      Returns:
      the value of the max record component
    • sum

      public long sum()
      Returns the value of the sum record component.
      Returns:
      the value of the sum record component
    • mean

      public double mean()
      Returns the value of the mean record component.
      Returns:
      the value of the mean record component
    • variance

      public double variance()
      Returns the value of the variance record component.
      Returns:
      the value of the variance record component
    • skewness

      public double skewness()
      Returns the value of the skewness record component.
      Returns:
      the value of the skewness record component
    • kurtosis

      public double kurtosis()
      Returns the value of the kurtosis record component.
      Returns:
      the value of the kurtosis record component