java.lang.Object
java.lang.Record
io.jenetics.stat.LongMoments
- Record Components:
count
- the count of values recordedmin
- the minimum value recorded, orLong.MAX_VALUE
if no values have been recordedmax
- the maximum value recorded, orLong.MIN_VALUE
if 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.NaN
if no values have been recordedskewness
- the Skewness of values recorded, orDouble.NaN
if less than two values have been recordedkurtosis
- the Kurtosis of values recorded, orDouble.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
ConstructorDescriptionLongMoments
(long count, long min, long max, long sum, double mean, double variance, double skewness, double kurtosis) Creates an instance of aLongMoments
record class. -
Method Summary
Modifier and TypeMethodDescriptionlong
count()
Returns the value of thecount
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.double
kurtosis()
Returns the value of thekurtosis
record component.long
max()
Returns the value of themax
record component.double
mean()
Returns the value of themean
record component.long
min()
Returns the value of themin
record component.static LongMoments
of
(LongMomentStatistics statistics) Return a new value object of the statistical moments, currently represented by thestatistics
object.double
skewness()
Returns the value of theskewness
record component.long
sum()
Returns the value of thesum
record component.static <N extends Number>
Collector<N,?, LongMoments> Return aCollector
which returns moments-statistics for the resulting values.static <T> Collector<T,
?, LongMoments> toLongMoments
(ToLongFunction<? super T> mapper) Return aCollector
which applies a long-producing mapping function to each input element, and returns moments-statistics for the resulting values.toString()
Returns a string representation of this record class.double
variance()
Returns the value of thevariance
record component.
-
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 aLongMoments
record class.- Parameters:
count
- the value for thecount
record componentmin
- the value for themin
record componentmax
- the value for themax
record componentsum
- the value for thesum
record componentmean
- the value for themean
record componentvariance
- the value for thevariance
record componentskewness
- the value for theskewness
record componentkurtosis
- the value for thekurtosis
record 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 thestatistics
object.- Parameters:
statistics
- the creating (mutable) statistics class- Returns:
- the statistical moments
-
toLongMoments
Return aCollector
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
Return aCollector
which applies a 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 givenmapper
isnull
-
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 thecount
record component.- Returns:
- the value of the
count
record component
-
min
Returns the value of themin
record component.- Returns:
- the value of the
min
record component
-
max
Returns the value of themax
record component.- Returns:
- the value of the
max
record component
-
sum
Returns the value of thesum
record component.- Returns:
- the value of the
sum
record component
-
mean
Returns the value of themean
record component.- Returns:
- the value of the
mean
record component
-
variance
Returns the value of thevariance
record component.- Returns:
- the value of the
variance
record component
-
skewness
Returns the value of theskewness
record component.- Returns:
- the value of the
skewness
record component
-
kurtosis
Returns the value of thekurtosis
record component.- Returns:
- the value of the
kurtosis
record component
-