java.lang.Object
java.lang.Record
io.jenetics.stat.IntSummary
- Record Components:
count
- the count of values recordedmin
- the minimum value recorded, orInteger.MAX_VALUE
if no values have been recordedmax
- the maximum value recorded, orInteger.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 recorded
- All Implemented Interfaces:
Serializable
public record IntSummary(long count, int min, int max, long sum, double mean)
extends Record
implements Serializable
Value objects which contains statistical summary information.
- Since:
- 3.0
- Version:
- 7.0
- See Also:
-
Constructor Summary
ConstructorDescriptionIntSummary
(long count, int min, int max, long sum, double mean) Creates an instance of aIntSummary
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.int
max()
Returns the value of themax
record component.static int
max
(int[] values) Return the maximum value of the given double array.double
mean()
Returns the value of themean
record component.static double
mean
(int[] values) Returns a double describing the arithmetic mean of the values, orDouble.NaN
if thevalues
array is empty.int
min()
Returns the value of themin
record component.static int
min
(int[] values) Return the minimum value of the given double array.static IntSummary
of
(IntSummaryStatistics statistics) Return a new value object of the statistical summary, currently represented by thestatistics
object.long
sum()
Returns the value of thesum
record component.static long
sum
(int[] values) Return the sum of the given double array.static <T> Collector
<T, ?, IntSummary> toIntSummary
(ToIntFunction<? super T> mapper) Return aCollector
which applies an int-producing mapping function to each input element, and return summary-statistics for the resulting values.toString()
Returns a string representation of this record class.
-
Constructor Details
-
IntSummary
Creates an instance of aIntSummary
record class.
-
-
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 summary, currently represented by thestatistics
object.- Parameters:
statistics
- the creating (mutable) statistics class- Returns:
- the statistical moments
-
toIntSummary
Return aCollector
which applies an int-producing mapping function to each input element, and return summary-statistics for the resulting values.final Stream<SomeObject> stream = ...; final IntSummary summary = stream .collect(toIntSummary(v -> v.intValue()));
- Type Parameters:
T
- the type of the input elements- Parameters:
mapper
- a mapping function to apply to each element- Returns:
- a
Collector
implementing the summary-statistics reduction - Throws:
NullPointerException
- if the givenmapper
isnull
-
min
Return the minimum value of the given double array.- Parameters:
values
- the array.- Returns:
- the minimum value or
Integer.MAX_VALUE
if the given array is empty. - Throws:
NullPointerException
- if the given array isnull
.- Since:
- 4.0
-
max
Return the maximum value of the given double array.- Parameters:
values
- the array.- Returns:
- the maximum value or
Integer.MIN_VALUE
if the given array is empty. - Throws:
NullPointerException
- if the given array isnull
.- Since:
- 4.0
-
sum
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
Returns a double describing the arithmetic mean of the values, orDouble.NaN
if thevalues
array is empty.- Parameters:
values
- the values to calculate the mean of- Returns:
- the arithmetic mean of the given
values
orDouble.NaN
if thevalues
array is empty - Throws:
NullPointerException
- if the given array isnull
.- Since:
- 4.0
-
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
-