java.lang.Object
java.lang.Record
io.jenetics.stat.DoubleSummary
- Record Components:
count- the count of values recordedmin- the minimum value recorded, orDouble.POSITIVE_INFINITYif no values have been recordedmax- the maximum value recorded, orDouble.NEGATIVE_INFINITYif 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 DoubleSummary(long count, double min, double max, double sum, double mean)
extends Record
implements Serializable
Value objects which contains statistical summary information.
- Since:
- 3.0
- Version:
- 7.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDoubleSummary(long count, double min, double max, double sum, double mean) Creates an instance of aDoubleSummaryrecord 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.doublemax()Returns the value of themaxrecord component.static doublemax(double[] values) Return the maximum value of the given double array.doublemean()Returns the value of themeanrecord component.static doublemean(double[] values) Returns a double describing the arithmetic mean of the values, orDouble.NaNif thevaluesarray is empty.doublemin()Returns the value of theminrecord component.static doublemin(double[] values) Return the minimum value of the given double array.static DoubleSummaryof(DoubleSummaryStatistics statistics) Return a new value object of the statistical summary, currently represented by thestatisticsobject.doublesum()Returns the value of thesumrecord component.static doublesum(double[] values) Return the sum of the given double array.static <T> Collector<T, ?, DoubleSummary> toDoubleSummary(ToDoubleFunction<? super T> mapper) Return aCollectorwhich applies a double-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
-
DoubleSummary
Creates an instance of aDoubleSummaryrecord 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 thestatisticsobject.- Parameters:
statistics- the creating (mutable) statistics class- Returns:
- the statistical moments
-
toDoubleSummary
Return aCollectorwhich applies a double-producing mapping function to each input element, and return summary-statistics for the resulting values.final Stream<SomeObject> stream = ...; final DoubleSummary summary = stream .collect(toDoubleSummary(v -> v.doubleValue()));- 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
Return the minimum value of the given double array.- Parameters:
values- the double array.- Returns:
- the minimum value or
Double.NaNif 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 double array.- Returns:
- the maximum value or
Double.NaNif 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.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
-
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
-