Interface AggregationRequestable<E>
- Type Parameters:
E- is the type of the elements aAggregationRequestable.
- All Known Subinterfaces:
IArrayList<E>, IContainer<E>, ILinkedList<E>, IMatrix<E>, IMatrixColumn<E>, IMatrixRow<E>, ISqlRecord
- All Known Implementing Classes:
AbstractContainer, AbstractExtendedContainer, ArrayContainerView, ArrayList, ContainerView, FilterContainerView, ImmutableList, IntervallContainerView, IterableContainerView, LinkedList, MappingContainerView, Matrix, MatrixColumn, MatrixRow, MultiContainerView, SingleContainer, SqlRecord
public interface AggregationRequestable<E>
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptiondoublegetAverage(Function<E, Number> valueMapper) doublegetAverageOrZero(Function<E, Number> valueMapper) <C extends Comparable<C>>
CdoublegetMaxOrZero(Function<E, Number> numberMapper) doubledoublegetMedianOrZero(Function<E, Number> numberMapper) <C extends Comparable<C>>
CdoublegetMinOrZero(Function<E, Number> numberMapper) doublegetStandardDeviation(Function<E, Number> numberMapper) getSumOfInts(ToIntFunction<E> intMapper) doublegetVariance(Function<E, Number> numberMapper)
-
Method Details
-
getAverage
- Parameters:
valueMapper-- Returns:
- the average of the values the given valueMapper maps from the
elements of the current
AggregationRequestable. Maps null elements to 0.0. - Throws:
RuntimeException- if the given valueMapper is null.RuntimeException- if the currentAggregationRequestableis empty.
-
getAverageOrZero
- Parameters:
valueMapper-- Returns:
- the average of the values the given valueMapper maps from the
elements of the current
AggregationRequestableif the currentAggregationRequestablecontains any, 0.0 otherwise. Maps null elements to 0.0. - Throws:
RuntimeException- if the given valueMapper is null.
-
getMax
- Type Parameters:
C- is the type of theComparables the given comparableMapper maps from the elements of the currentAggregationRequestable.- Parameters:
comparableMapper-- Returns:
- the biggest
Comparablethe given comparableMapper maps from the elements of the currentAggregationRequestable. Ignores null elements. - Throws:
RuntimeException- if the given comparableMapper is null.RuntimeException- if the currentAggregationRequestabledoes not contain a non-null element.
-
getMaxOrZero
- Parameters:
numberMapper-- Returns:
- the biggest number the given numberMapper maps from the non-null
elements of the current
AggregationRequestableif the currentAggregationRequestablecontains non-null elements, 0.0 otherwise.
-
getMedian
- Parameters:
numberMapper-- Returns:
- the median of the numbers the given numberMapper maps from the
elements of the current
AggregationRequestable. Maps null elements to 0.0. - Throws:
RuntimeException- if the given numberMapper is null.RuntimeException- if the currentAggregationRequestableis empty.
-
getMedianOrZero
- Parameters:
numberMapper-- Returns:
- the median of the numbers the given numberMapper maps from the
elements of the current
AggregationRequestableif the currentAggregationRequestableis not empty, 0.0 otherwise. Maps null elements to 0.0. - Throws:
RuntimeException- if the given numberMapper is null.
-
getMin
- Type Parameters:
C- is the type of theComparables the given comparableMapper maps from the elements of the currentAggregationRequestable.- Parameters:
comparableMapper-- Returns:
- the smallest
Comparablethe given comparableMapper maps from the elements of the currentAggregationRequestable. Ignores null elements. - Throws:
RuntimeException- if the given comparableMapper is null.RuntimeException- if the currentAggregationRequestabledoes not contain a non-null element.
-
getMinOrZero
- Parameters:
numberMapper-- Returns:
- the smallest number the given numberMapper maps from the non-null
elements of the current
AggregationRequestableif the currentAggregationRequestablecontains non-null elements, 0.0 otherwise.
-
getStandardDeviation
- Parameters:
numberMapper-- Returns:
- the standard deviation of the numbers the given numberMapper maps
from the elements of the current
AggregationRequestable. - Throws:
RuntimeException- if the given numberMapper is null.RuntimeException- if the currentAggregationRequestableis empty.
-
getSum
- Parameters:
valueMapper-- Returns:
- the sum of the values the given valueMapper maps from the elements of
the current
AggregationRequestable. Maps null elements to 0.0. - Throws:
RuntimeException- if the given valueMapper is null.
-
getSumOfInts
- Parameters:
intMapper-- Returns:
- the sum of the ints the given intMapper maps from the elements of the
current
AggregationRequestable. Maps null elements to 0.0. - Throws:
RuntimeException- if the given intMapper is null.
-
getVariance
- Parameters:
numberMapper-- Returns:
- the variance of the numbers the given numberMapper maps from the
elements of the current
AggregationRequestable. Maps null elements to 0.0. - Throws:
RuntimeException- if the given numberMapper is null.RuntimeException- if the currentAggregationRequestableis empty.
-