Class FeatureCalculatorSingleChangeInput<T extends FeatureInput>
Object
FeatureCalculatorSingleChangeInput<T>
- Type Parameters:
T
- feature-input-type
- All Implemented Interfaces:
FeatureCalculatorSingle<T>
public class FeatureCalculatorSingleChangeInput<T extends FeatureInput>
extends Object
implements FeatureCalculatorSingle<T>
A
FeatureCalculatorSingle
but changes the input before calculation.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureCalculatorSingleChangeInput
(FeatureCalculatorSingle<T> calculator, Consumer<T> change) Creates a newFeatureCalculatorSingleChangeInput
instance. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Calculate the results of the feature with a particular input.double
calculateSuppressErrors
(T input, ErrorReporter errorReporter) Calculates the result for aninput
recording the error to anErrorReporter
if anything goes wrong, but throwing no exception.
-
Constructor Details
-
FeatureCalculatorSingleChangeInput
public FeatureCalculatorSingleChangeInput(FeatureCalculatorSingle<T> calculator, Consumer<T> change) Creates a newFeatureCalculatorSingleChangeInput
instance.- Parameters:
calculator
- Delegate which is called after an input is changed.change
- A function that is applied to change the input before being passed tocalculator
.
-
-
Method Details
-
calculate
Description copied from interface:FeatureCalculatorSingle
Calculate the results of the feature with a particular input.- Specified by:
calculate
in interfaceFeatureCalculatorSingle<T extends FeatureInput>
- Parameters:
input
- the input to calculate.- Returns:
- the results of the calculation.
- Throws:
FeatureCalculationException
- if the feature cannot be successfully calculated.
-
calculateSuppressErrors
Description copied from interface:FeatureCalculatorSingle
Calculates the result for aninput
recording the error to anErrorReporter
if anything goes wrong, but throwing no exception.- Specified by:
calculateSuppressErrors
in interfaceFeatureCalculatorSingle<T extends FeatureInput>
- Parameters:
input
- the input to calculate.errorReporter
- where errors are recorded.- Returns:
- the result of the calculation.
-