Class WithValueBase<T extends FeatureInput>
Object
AnchorBean<Feature<T>>
InitializableBean<Feature<T>,FeatureInitialization>
Feature<T>
FeatureUnary<T,T>
FeatureUnaryGeneric<T>
WithValueBase<T>
- Type Parameters:
T- the type ofFeatureInputthis feature operates on
- Direct Known Subclasses:
AddConstantTo,ConstantToThePowerOf,DivideByConstant,MultiplyByConstant,ReplaceUnusualValue,SubtractFrom,ToThePowerOfConstant
A base class for operations that use a specified constant value in combination with a feature.
This abstract class extends FeatureUnaryGeneric to provide a framework for combining a
constant value with the result of a feature calculation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublecalculate(FeatureCalculationInput<T> input) Calculates a value for some input.protected abstract StringcombineDescription(String valueDescription, String featureDescription) Combines the descriptions of the constant value and the feature.protected abstract doublecombineValueAndFeature(double value, double featureResult) Combines the constant value with the feature result.A long human-readable description of the feature and some or all of its parameterization.doublegetValue()The constant value to be used in the operation.voidsetValue(double value) The constant value to be used in the operation.Methods inherited from class org.anchoranalysis.feature.bean.operator.FeatureUnary
getItem, inputType, setItemMethods inherited from class org.anchoranalysis.feature.bean.Feature
assignTo, beforeCalc, calculateCheckInitialized, castAs, createListChildFeatures, describeBean, describeParameters, duplicateChangeName, getCustomName, getFriendlyName, onInitialization, setCustomName, toStringMethods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitializedMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise
-
Constructor Details
-
WithValueBase
public WithValueBase()
-
-
Method Details
-
calculate
Description copied from class:FeatureCalculates a value for some input.- Specified by:
calculatein classFeature<T extends FeatureInput>- Parameters:
input- the input to the calculation.- Returns:
- the result of the calculation.
- Throws:
FeatureCalculationException- if the calculation cannot successfully complete.
-
descriptionLong
Description copied from class:FeatureA long human-readable description of the feature and some or all of its parameterization.This can be overwritten to create an alternative description for features. By default string returned by
Feature.describeBean()is used.- Overrides:
descriptionLongin classFeature<T extends FeatureInput>- Returns:
- the description.
-
combineValueAndFeature
protected abstract double combineValueAndFeature(double value, double featureResult) Combines the constant value with the feature result.- Parameters:
value- the constant value specified for this operationfeatureResult- the result of the feature calculation- Returns:
- the combined result
-
combineDescription
Combines the descriptions of the constant value and the feature.- Parameters:
valueDescription- the description of the constant valuefeatureDescription- the description of the feature- Returns:
- the combined description
-
getValue
public double getValue()The constant value to be used in the operation. Default value is 0. -
setValue
public void setValue(double value) The constant value to be used in the operation. Default value is 0.
-