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 CalculationParts.

Author:
Owen Feehan
  • Method Details

    • get

      T get()
      The underlying feature-input.
      Returns:
      the feature-input.
    • calculate

      double calculate(Feature<T> feature) throws FeatureCalculationException
      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

      <S> S calculate(CalculationPart<S,T> calculation) throws FeatureCalculationException
      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

      <S> S calculate(ResolvedPart<S,T> calculation) throws FeatureCalculationException
      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

      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

      Calculates a feature if only an symbol (ID/name) is known, which refers to another feature.
      Returns:
      the calculator.
    • getCache

      Get the associated FeatureCalculationCache.
      Returns:
      the associated cache.