## Interface DerivedCalculationFunction<T extends CalculationTarget,​R>

• Type Parameters:
T - the type of the target handled by this function, often a trade
R - the type of value calculated by this function
All Known Implementing Classes:
AbstractDerivedCalculationFunction

public interface DerivedCalculationFunction<T extends CalculationTarget,​R>
A derived calculation function calculates one measure using the measures calculated by another function.

Strata executes the other function and checks that all required measures are available before calling this function.

A derived calculation function can be added to an existing set of calculation functions using CalculationFunctions.composedWith(DerivedCalculationFunction[]).

• ### Method Summary

All Methods
Modifier and Type Method Description
R calculate​(T target, Map<Measure,​Object> requiredMeasures, CalculationParameters parameters, ScenarioMarketData marketData, ReferenceData refData)
Calculates the measure.
Measure measure()
Returns the measure calculated by the function.
Set<Measure> requiredMeasures()
Returns the measures required by this function to calculate its measure.
FunctionRequirements requirements​(T target, CalculationParameters parameters, ReferenceData refData)
Returns requirements for the market data required by this function to calculate its measure.
Class<T> targetType()
Returns the type of calculation target handled by the function.
• ### Method Detail

• #### targetType

Class<T> targetType()
Returns the type of calculation target handled by the function.
Returns:
the type of calculation target handled by the function
• #### measure

Measure measure()
Returns the measure calculated by the function.
Returns:
the measure calculated by the function
• #### requiredMeasures

Set<Measure> requiredMeasures()
Returns the measures required by this function to calculate its measure.
Returns:
the measures required by this function to calculate its measure
• #### requirements

FunctionRequirements requirements​(T target,
CalculationParameters parameters,
ReferenceData refData)
Returns requirements for the market data required by this function to calculate its measure.
Parameters:
target - the target of the calculation, often a trade
parameters - the calculation parameters specifying how the calculations should be performed
refData - the reference data used in the calculations
Returns:
requirements for the market data required by this function to calculate its measure
• #### calculate

R calculate​(T target,
Map<Measure,​Object> requiredMeasures,
CalculationParameters parameters,
ScenarioMarketData marketData,
ReferenceData refData)
Calculates the measure.

This method is only invoked if all of the required measures are available. Therefore implementation can safely assume that requiredMeasures contains all the required data.

Parameters:
target - the target of the calculation, often a trade
requiredMeasures - the calculated measure values required by this function to calculate its measure
parameters - the calculation parameters specifying how the calculations should be performed
marketData - the market data used in the calculations
refData - the reference data used in the calculations
Returns:
the calculated measure value.