Class CalculateInputFromDelegate<S,T extends FeatureInput,U>
Object
CalculationPart<S,T>
CalculateInputFromDelegate<S,T,U>
- Type Parameters:
S- final-type ofCalculationPart.T- feature input-type as input to cached-calculations.U- delegate-type ofCalculationPart.
- All Implemented Interfaces:
ResettableCalculation
- Direct Known Subclasses:
CalculateInputFromDelegateOption,CalculateIntersecting
public abstract class CalculateInputFromDelegate<S,T extends FeatureInput,U>
extends CalculationPart<S,T>
A base class for
CalculationParts that derive from an existing "delegate" calculation.
These types of calculations involve two steps:
- Calculating from an existing
CalculationPart. - Applying a transform to generate parameters.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCalculateInputFromDelegate(ResolvedPart<U, T> delegate) Creates a newCalculateInputFromDelegateinstance.protectedCalculateInputFromDelegate(CalculationPart<U, T> delegate, CalculationPartResolver<T> cache) Creates a newCalculateInputFromDelegate. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected abstract SderiveFromDelegate(T input, U delegate) Derives the result from the delegate calculation.booleanThis performs the actual calculation when needed.protected ResolvedPart<U, T> Gets the delegateResolvedPart.inthashCode()Methods inherited from class org.anchoranalysis.feature.calculate.part.CalculationPart
getOrCalculate, hasCachedResult, invalidate
-
Constructor Details
-
CalculateInputFromDelegate
protected CalculateInputFromDelegate(CalculationPart<U, T> delegate, CalculationPartResolver<T> cache) Creates a newCalculateInputFromDelegate.- Parameters:
delegate- the delegateCalculationPartcache- theCalculationPartResolverto use for caching
-
CalculateInputFromDelegate
Creates a newCalculateInputFromDelegateinstance.- Parameters:
delegate- The resolved part for the delegate calculation.
-
-
Method Details
-
execute
Description copied from class:CalculationPartThis performs the actual calculation when needed. It should only be called once, untilCalculationPart.invalidate()is called.- Specified by:
executein classCalculationPart<S,T extends FeatureInput> - Parameters:
input- the input to the calculation.- Returns:
- the result of the calculation.
- Throws:
FeatureCalculationException- if the calculation cannot be successfully completed.
-
deriveFromDelegate
Derives the result from the delegate calculation.- Parameters:
input- the input for the calculationdelegate- the result of the delegate calculation- Returns:
- the derived result
-
getDelegate
Gets the delegateResolvedPart.- Returns:
- the delegate
ResolvedPart
-
equals
- Specified by:
equalsin classCalculationPart<S,T extends FeatureInput>
-
canEqual
-
hashCode
public int hashCode()- Specified by:
hashCodein classCalculationPart<S,T extends FeatureInput>
-