java.lang.Object
java.lang.Record
io.jenetics.stat.IntMoments
- Record Components:
count- the count of values recordedmin- the minimum value recorded, orInteger.MAX_VALUEif no values have been recordedmax- the maximum value recorded, orInteger.MIN_VALUEif no values have been recordedsum- the sum of values recorded, or zero if no values have been recordedmean- the arithmetic mean of values recorded, or zero if no values have been recordedvariance- the variance of values recorded, orDouble.NaNif no values have been recordedskewness- the Skewness of values recorded, orDouble.NaNif less than two values have been recordedkurtosis- the Kurtosis of values recorded, orDouble.NaNif less than four values have been recorded
- All Implemented Interfaces:
Serializable
public record IntMoments(long count, int min, int 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
ConstructorsConstructorDescriptionIntMoments(long count, int min, int max, long sum, double mean, double variance, double skewness, double kurtosis) Creates an instance of aIntMomentsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongcount()Returns the value of thecountrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doublekurtosis()Returns the value of thekurtosisrecord component.intmax()Returns the value of themaxrecord component.doublemean()Returns the value of themeanrecord component.intmin()Returns the value of theminrecord component.static IntMomentsof(IntMomentStatistics statistics) Return a new value object of the statistical moments, currently represented by thestatisticsobject.doubleskewness()Returns the value of theskewnessrecord component.longsum()Returns the value of thesumrecord component.static <N extends Number>
Collector<N, ?, IntMoments> Return aCollectorwhich returns moments-statistics for the resulting values.static <T> Collector<T, ?, IntMoments> toIntMoments(ToIntFunction<? super T> mapper) Return aCollectorwhich applies an int-producing mapping function to each input element, and returns moments-statistics for the resulting values.toString()Returns a string representation of this record class.doublevariance()Returns the value of thevariancerecord component.
-
Constructor Details
-
IntMoments
public IntMoments(long count, int min, int max, long sum, double mean, double variance, double skewness, double kurtosis) Creates an instance of aIntMomentsrecord class.- Parameters:
count- the value for thecountrecord componentmin- the value for theminrecord componentmax- the value for themaxrecord componentsum- the value for thesumrecord componentmean- the value for themeanrecord componentvariance- the value for thevariancerecord componentskewness- the value for theskewnessrecord componentkurtosis- the value for thekurtosisrecord component
-
-
Method Details
-
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. -
of
Return a new value object of the statistical moments, currently represented by thestatisticsobject.- Parameters:
statistics- the creating (mutable) statistics class- Returns:
- the statistical moments
-
toIntMoments
Return aCollectorwhich returns moments-statistics for the resulting values.final Stream<Integer> stream = ...; final IntMoments moments = stream.collect(toIntMoments());- Type Parameters:
N- the type of the input elements- Returns:
- a
Collectorimplementing the moments-statistics reduction - Since:
- 4.1
-
toIntMoments
Return aCollectorwhich applies an int-producing mapping function to each input element, and returns moments-statistics for the resulting values.final Stream<SomeObject> stream = ...; final IntMoments moments = stream .collect(toIntMoments(v -> v.intValue()));- Type Parameters:
T- the type of the input elements- Parameters:
mapper- a mapping function to apply to each element- Returns:
- a
Collectorimplementing the moments-statistics reduction - Throws:
NullPointerException- if the givenmapperisnull
-
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
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 '=='. -
count
Returns the value of thecountrecord component.- Returns:
- the value of the
countrecord component
-
min
Returns the value of theminrecord component.- Returns:
- the value of the
minrecord component
-
max
Returns the value of themaxrecord component.- Returns:
- the value of the
maxrecord component
-
sum
Returns the value of thesumrecord component.- Returns:
- the value of the
sumrecord component
-
mean
Returns the value of themeanrecord component.- Returns:
- the value of the
meanrecord component
-
variance
Returns the value of thevariancerecord component.- Returns:
- the value of the
variancerecord component
-
skewness
Returns the value of theskewnessrecord component.- Returns:
- the value of the
skewnessrecord component
-
kurtosis
Returns the value of thekurtosisrecord component.- Returns:
- the value of the
kurtosisrecord component
-