Package io.jenetics.stat
Class LongMoments
- java.lang.Object
-
- io.jenetics.stat.LongMoments
-
- All Implemented Interfaces:
Serializable
public final class LongMoments extends Object implements Serializable
Value objects which contains statistical moments.- Since:
- 3.0
- Version:
- 6.0
- See Also:
LongMomentStatistics, Serialized Form- Implementation Note:
- This class is immutable and thread-safe.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longcount()Returns the count of values recorded.booleanequals(Object obj)inthashCode()doublekurtosis()Return the kurtosis of values recorded, orDouble.NaNif less than four values have been recorded.longmax()Return the maximum value recorded, orLong.MIN_VALUEif no values have been recorded.doublemean()Return the arithmetic mean of values recorded, or zero if no values have been recorded.longmin()Return the minimum value recorded, orLong.MAX_VALUEif no values have been recorded.static LongMomentsof(long count, long min, long max, long sum, double mean, double variance, double skewness, double kurtosis)Create an immutable object which contains statistical values.static LongMomentsof(LongMomentStatistics statistics)Return a new value object of the statistical moments, currently represented by thestatisticsobject.doubleskewness()Return the skewness of values recorded, orDouble.NaNif less than two values have been recorded.longsum()Return the sum of values recorded, or zero if no values have been recorded.static <N extends Number>
Collector<N,?,LongMoments>toLongMoments()Return aCollectorwhich returns moments-statistics for the resulting values.static <T> Collector<T,?,LongMoments>toLongMoments(ToLongFunction<? super T> mapper)Return aCollectorwhich applies an long-producing mapping function to each input element, and returns moments-statistics for the resulting values.StringtoString()doublevariance()Return the variance of values recorded, orDouble.NaNif no values have been recorded.
-
-
-
Method Detail
-
count
public long count()
Returns the count of values recorded.- Returns:
- the count of recorded values
-
min
public long min()
Return the minimum value recorded, orLong.MAX_VALUEif no values have been recorded.- Returns:
- the minimum value, or
Long.MAX_VALUEif none
-
max
public long max()
Return the maximum value recorded, orLong.MIN_VALUEif no values have been recorded.- Returns:
- the maximum value, or
Long.MIN_VALUEif none
-
sum
public long sum()
Return the sum of values recorded, or zero if no values have been recorded.- Returns:
- the sum of values, or zero if none
-
mean
public double mean()
Return the arithmetic mean of values recorded, or zero if no values have been recorded.- Returns:
- the arithmetic mean of values, or zero if none
-
variance
public double variance()
Return the variance of values recorded, orDouble.NaNif no values have been recorded.- Returns:
- the variance of values, or
NaNif none
-
skewness
public double skewness()
Return the skewness of values recorded, orDouble.NaNif less than two values have been recorded.- Returns:
- the skewness of values, or
NaNif less than two values have been recorded - See Also:
- Skewness
-
kurtosis
public double kurtosis()
Return the kurtosis of values recorded, orDouble.NaNif less than four values have been recorded.- Returns:
- the kurtosis of values, or
NaNif less than four values have been recorded - See Also:
- Kurtosis
-
of
public static LongMoments of(long count, long min, long max, long sum, double mean, double variance, double skewness, double kurtosis)
Create an immutable object which contains statistical values.- Parameters:
count- the count of values recordedmin- the minimum valuemax- the maximum valuesum- the sum of the recorded valuesmean- the arithmetic mean of valuesvariance- the variance of valuesskewness- the skewness of valueskurtosis- the kurtosis of values- Returns:
- an immutable object which contains statistical values
-
of
public static LongMoments of(LongMomentStatistics statistics)
Return a new value object of the statistical moments, currently represented by thestatisticsobject.- Parameters:
statistics- the creating (mutable) statistics class- Returns:
- the statistical moments
-
toLongMoments
public static <N extends Number> Collector<N,?,LongMoments> toLongMoments()
Return aCollectorwhich 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
Collectorimplementing the moments-statistics reduction - Since:
- 4.1
-
toLongMoments
public static <T> Collector<T,?,LongMoments> toLongMoments(ToLongFunction<? super T> mapper)
Return aCollectorwhich 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
Collectorimplementing the moments-statistics reduction - Throws:
NullPointerException- if the givenmapperisnull
-
-