Package io.jenetics.stat
Class LongSummary
- java.lang.Object
-
- io.jenetics.stat.LongSummary
-
- All Implemented Interfaces:
Serializable
public final class LongSummary extends Object implements Serializable
Value objects which contains statistical summary information.- Since:
- 3.0
- Version:
- 6.0
- See Also:
LongSummaryStatistics, 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()longmax()Return the maximum value recorded, orLong.MIN_VALUEif no values have been recorded.static longmax(long[] values)Return the maximum value of the given double array.doublemean()Return the arithmetic mean of values recorded, or zero if no values have been recorded.static doublemean(long[] values)Returns a double describing the arithmetic mean of the values, orDouble.NaNif thevaluesarray is empty.longmin()Return the minimum value recorded, orLong.MAX_VALUEif no values have been recorded.static longmin(long[] values)Return the minimum value of the given double array.static LongSummaryof(long count, long min, long max, long sum, double mean)Create an immutable object which contains statistical summary values.static LongSummaryof(LongSummaryStatistics statistics)Return a new value object of the statistical summary, currently represented by thestatisticsobject.longsum()Return the sum of values recorded, or zero if no values have been recorded.static longsum(long[] values)Return the sum of the given double array.static <T> Collector<T,?,LongSummary>toLongSummary(ToLongFunction<? super T> mapper)Return aCollectorwhich applies an long-producing mapping function to each input element, and returns summary-statistics for the resulting values.StringtoString()
-
-
-
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
-
of
public static LongSummary of(long count, long min, long max, long sum, double mean)
Create an immutable object which contains statistical summary values.- Parameters:
count- the count of values recordedmin- the minimum valuemax- the maximum valuesum- the sum of the recorded valuesmean- the arithmetic mean of values- Returns:
- an immutable object which contains statistical values
-
of
public static LongSummary of(LongSummaryStatistics statistics)
Return a new value object of the statistical summary, currently represented by thestatisticsobject.- Parameters:
statistics- the creating (mutable) statistics class- Returns:
- the statistical moments
-
toLongSummary
public static <T> Collector<T,?,LongSummary> toLongSummary(ToLongFunction<? super T> mapper)
Return aCollectorwhich applies an long-producing mapping function to each input element, and returns summary-statistics for the resulting values.final Stream<SomeObject> stream = ... final LongSummary summary = stream .collect(toLongSummary(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 summary-statistics reduction - Throws:
NullPointerException- if the givenmapperisnull
-
min
public static long min(long[] values)
Return the minimum value of the given double array.- Parameters:
values- the array.- Returns:
- the minimum value or
Long.MAX_VALUEif the given array is empty. - Throws:
NullPointerException- if the given array isnull.- Since:
- 4.0
-
max
public static long max(long[] values)
Return the maximum value of the given double array.- Parameters:
values- the array.- Returns:
- the maximum value or
Long.MIN_VALUEif the given array is empty. - Throws:
NullPointerException- if the given array isnull.- Since:
- 4.0
-
sum
public static long sum(long[] values)
Return the sum of the given double array.- Parameters:
values- the values to sum up.- Returns:
- the sum of the given
values. - Throws:
NullPointerException- if the given array isnull.- Since:
- 4.0
-
mean
public static double mean(long[] values)
Returns a double describing the arithmetic mean of the values, orDouble.NaNif thevaluesarray is empty.- Parameters:
values- the values to calculate the mean of- Returns:
- the arithmetic mean of the given
valuesorDouble.NaNif thevaluesarray is empty - Throws:
NullPointerException- if the given array isnull.- Since:
- 4.0
-
-