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
CalculationPart
s 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
ConstructorsModifierConstructorDescriptionprotected
CalculateInputFromDelegate
(ResolvedPart<U, T> delegate) Creates a newCalculateInputFromDelegate
instance.protected
CalculateInputFromDelegate
(CalculationPart<U, T> delegate, CalculationPartResolver<T> cache) Creates a newCalculateInputFromDelegate
. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected abstract S
deriveFromDelegate
(T input, U delegate) Derives the result from the delegate calculation.boolean
This performs the actual calculation when needed.protected ResolvedPart
<U, T> Gets the delegateResolvedPart
.int
hashCode()
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 delegateCalculationPart
cache
- theCalculationPartResolver
to use for caching
-
CalculateInputFromDelegate
Creates a newCalculateInputFromDelegate
instance.- Parameters:
delegate
- The resolved part for the delegate calculation.
-
-
Method Details
-
execute
Description copied from class:CalculationPart
This performs the actual calculation when needed. It should only be called once, untilCalculationPart.invalidate()
is called.- Specified by:
execute
in 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:
equals
in classCalculationPart<S,
T extends FeatureInput>
-
canEqual
-
hashCode
public int hashCode()- Specified by:
hashCode
in classCalculationPart<S,
T extends FeatureInput>
-