Class FeatureCalculatorMultiChangeInput<T extends FeatureInput>
Object
FeatureCalculatorMultiChangeInput<T>
- Type Parameters:
T
- feature-input-type
- All Implemented Interfaces:
FeatureCalculatorMulti<T>
public class FeatureCalculatorMultiChangeInput<T extends FeatureInput>
extends Object
implements FeatureCalculatorMulti<T>
A
FeatureCalculatorMulti
but changes the input before calculation.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureCalculatorMultiChangeInput
(FeatureCalculatorMulti<T> calculator, Consumer<T> change) Creates a newFeatureCalculatorMultiChangeInput
instance. -
Method Summary
Modifier and TypeMethodDescriptionCalculate the results of the features with a particular input.calculate
(T input, FeatureList<T> featuresSubset) Calculates the results of a subset of the features with a particular input.calculateSuppressErrors
(T input, ErrorReporter errorReporter) Calculates the results for aninput
recording the error to anErrorReporter
if anything goes wrong, but throwing no exception.int
The number of features that is calculated on each call toFeatureCalculatorMulti.calculate(T)
, and therefore the size of the returnedResultsVector
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.anchoranalysis.feature.calculate.bound.FeatureCalculatorMulti
calculate
-
Constructor Details
-
FeatureCalculatorMultiChangeInput
Creates a newFeatureCalculatorMultiChangeInput
instance.- Parameters:
calculator
- Delegate that is called after an input is changed.change
- A function that is applied to change the input before being passed to the delegate.
-
-
Method Details
-
calculate
Description copied from interface:FeatureCalculatorMulti
Calculate the results of the features with a particular input.- Specified by:
calculate
in interfaceFeatureCalculatorMulti<T extends FeatureInput>
- Parameters:
input
- the input to calculate.- Returns:
- the results of the calculation.
- Throws:
NamedFeatureCalculateException
- if any feature cannot be successfully calculated.
-
calculate
public ResultsVector calculate(T input, FeatureList<T> featuresSubset) throws NamedFeatureCalculateException Description copied from interface:FeatureCalculatorMulti
Calculates the results of a subset of the features with a particular input.- Specified by:
calculate
in interfaceFeatureCalculatorMulti<T extends FeatureInput>
- Parameters:
input
- the input to calculate.featuresSubset
- the subset of features (from those bound to the current instance) to calculate with.- Returns:
- the results of the calculation.
- Throws:
NamedFeatureCalculateException
- if any feature cannot be successfully calculated.
-
calculateSuppressErrors
Description copied from interface:FeatureCalculatorMulti
Calculates the results for aninput
recording the error to anErrorReporter
if anything goes wrong, but throwing no exception.- Specified by:
calculateSuppressErrors
in interfaceFeatureCalculatorMulti<T extends FeatureInput>
- Parameters:
input
- the input to calculate.errorReporter
- where errors are recorded.- Returns:
- the results of the calculation.
-
sizeFeatures
public int sizeFeatures()Description copied from interface:FeatureCalculatorMulti
The number of features that is calculated on each call toFeatureCalculatorMulti.calculate(T)
, and therefore the size of the returnedResultsVector
.- Specified by:
sizeFeatures
in interfaceFeatureCalculatorMulti<T extends FeatureInput>
- Returns:
- the number of features.
-