Interface FeatureCalculationInput<T extends FeatureInput>
- Type Parameters:
T
- underlying feature-input type.
- All Known Implementing Classes:
SessionInputSequential
public interface FeatureCalculationInput<T extends FeatureInput>
Gives a
FeatureInput
the necessary context for feature-calculation, including associating
it with a cache.
This is the recommended method for calculating the value of a Feature
as it allows
sensible caching / memoization to occur of subcomponents of the feature's computation (known as
CalculationPart
s.
- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptionbySymbol()
Calculates a feature if only an symbol (ID/name) is known, which refers to another feature.double
Calculates the result of a feature using this input.calculate
(FeatureList<T> features) Calculates the results of several features using this input.<S> S
calculate
(ResolvedPart<S, T> calculation) Calculates a resolved Feature-calculation.<S> S
calculate
(CalculationPart<S, T> calculation) Calculates a feature-calculation after resolving it against the main cache.forChild()
Performs calculations not on the main cache, but on a child cache.get()
The underlying feature-input.getCache()
Get the associatedFeatureCalculationCache
.resolver()
A resolver for calculations.
-
Method Details
-
get
T get()The underlying feature-input.- Returns:
- the feature-input.
-
calculate
Calculates the result of a feature using this input.- Parameters:
feature
- the feature to calculate with.- Returns:
- the result of the calculation.
- Throws:
FeatureCalculationException
- if a feature cannot be successfully calculated.
-
calculate
Calculates the results of several features using this input.- Parameters:
features
- features to calculate with.- Returns:
- the results of each feature's calculation respectively.
- Throws:
NamedFeatureCalculateException
- if any feature cannot be successfully calculated.
-
calculate
Calculates a feature-calculation after resolving it against the main cache.- Type Parameters:
S
- return-type of the calculation.- Parameters:
calculation
- the feature-calculation to resolve.- Returns:
- the result of the calculation.
- Throws:
FeatureCalculationException
- if a feature cannot be successfully calculated.
-
calculate
Calculates a resolved Feature-calculation.- Type Parameters:
S
- return-type of the calculation.- Parameters:
calculation
- the feature-calculation to resolve.- Returns:
- the result of the calculation.
- Throws:
FeatureCalculationException
- if a feature cannot be successfully calculated.
-
resolver
CalculationPartResolver<T> resolver()A resolver for calculations.- Returns:
- the resolver.
-
forChild
CalculateForChild<T> forChild()Performs calculations not on the main cache, but on a child cache.- Returns:
- the calculator.
-
bySymbol
FeatureSymbolCalculator<T> bySymbol()Calculates a feature if only an symbol (ID/name) is known, which refers to another feature.- Returns:
- the calculator.
-
getCache
FeatureCalculationCache<T> getCache()Get the associatedFeatureCalculationCache
.- Returns:
- the associated cache.
-