Package org.midheaven.math
Interface Arithmetic<T,D>
- Type Parameters:
T- type of the element in the ArithmeticD- type of the element resulting from dividingTby a whole number
public interface Arithmetic<T,D>
Defines the contract for Arithmetic.
-
Method Summary
Modifier and TypeMethodDescriptionPerforms averageCollector.static <V,R> Arithmetic <V, R> of(V zero, BiFunction<V, V, V> sum, BiFunction<V, Long, R> over) Creates an instance from the provided value.Performs over.Performs sum.Performs sumCollector.zero()Performs zero.
-
Method Details
-
of
Creates an instance from the provided value.- Parameters:
zero- the zero valuesum- the sum valueover- the over value- Returns:
- the result of applying th operation
-
zero
T zero()Performs zero.- Returns:
- the result of zero
-
sum
Performs sum.- Parameters:
a- the a valueb- the b value- Returns:
- the result of sum
-
over
Performs over.- Parameters:
a- the a valueb- the b value- Returns:
- the result of over
-
sumCollector
Performs sumCollector.- Returns:
- the result of sumCollector
-
averageCollector
Performs averageCollector.- Returns:
- the result of averageCollector
-