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 newFeatureCalculatorSingleChangeInputinstance. -
Method Summary
Modifier and TypeMethodDescriptiondoubleCalculate the results of the feature with a particular input.doublecalculateSuppressErrors(T input, ErrorReporter errorReporter) Calculates the result for aninputrecording the error to anErrorReporterif anything goes wrong, but throwing no exception.
-
Constructor Details
-
FeatureCalculatorSingleChangeInput
public FeatureCalculatorSingleChangeInput(FeatureCalculatorSingle<T> calculator, Consumer<T> change) Creates a newFeatureCalculatorSingleChangeInputinstance.- 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:FeatureCalculatorSingleCalculate the results of the feature with a particular input.- Specified by:
calculatein 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:FeatureCalculatorSingleCalculates the result for aninputrecording the error to anErrorReporterif anything goes wrong, but throwing no exception.- Specified by:
calculateSuppressErrorsin interfaceFeatureCalculatorSingle<T extends FeatureInput>- Parameters:
input- the input to calculate.errorReporter- where errors are recorded.- Returns:
- the result of the calculation.
-