Class ConvertUnits<T extends FeatureInput>
Object
AnchorBean<Feature<T>>
InitializableBean<Feature<T>,FeatureInitialization>
Feature<T>
FeatureUnary<T,T>
FeatureUnaryGeneric<T>
ConvertUnits<T>
- Type Parameters:
T
- the type ofFeatureInput
this feature operates on
Converts a feature value from one unit type to another.
This class extends FeatureUnaryGeneric
to provide unit conversion functionality for
feature values using SpatialUnits
.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected double
calculate
(FeatureCalculationInput<T> input) Calculates a value for some input.The unit type to convert from.The unit type to convert to.void
setUnitTypeFrom
(String unitTypeFrom) The unit type to convert from.void
setUnitTypeTo
(String unitTypeTo) The unit type to convert to.Methods inherited from class org.anchoranalysis.feature.bean.operator.FeatureUnary
getItem, inputType, setItem
Methods inherited from class org.anchoranalysis.feature.bean.Feature
assignTo, beforeCalc, calculateCheckInitialized, castAs, createListChildFeatures, describeBean, describeParameters, descriptionLong, duplicateChangeName, getCustomName, getFriendlyName, onInitialization, setCustomName, toString
Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise
-
Constructor Details
-
ConvertUnits
public ConvertUnits()
-
-
Method Details
-
calculate
Description copied from class:Feature
Calculates a value for some input.- Specified by:
calculate
in 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.
-
getUnitTypeFrom
The unit type to convert from. An empty string means no conversion is applied when converting from this unit. -
setUnitTypeFrom
The unit type to convert from. An empty string means no conversion is applied when converting from this unit. -
getUnitTypeTo
The unit type to convert to. An empty string means no conversion is applied when converting to this unit. -
setUnitTypeTo
The unit type to convert to. An empty string means no conversion is applied when converting to this unit.
-