Interface CalculationTaskRunner

This interface is the lower-level counterpart to CalculationRunner.
It provides the ability to calculate results based on CalculationTasks.
Unless you need to optimize, the CalculationRunner is a simpler entry point.

The purpose of the runner is to produce a grid of results, with a row for each target
and a column for each measure. The targets and columns that define the grid of results
are passed in using an instance of CalculationTasks.

The CalculationTasks instance is obtained using a
static factory method.
It consists of a list of CalculationTask instances, where each task instance
corresponds to a single cell in the grid of results. When the CalculationTasks
instance is created for a set of trades and measures some one-off initialization is performed.
Providing access to the instance allows the initialization to occur once, which could
be a performance optimization if many different calculations are performed with the
same set of trades and measures.

Once obtained, the CalculationTasks instance may be used to calculate results.
The four "calculate" methods handle the combination of single versus scenario market data,
and synchronous versus asynchronous.

A calculation runner is typically obtained using the static methods on this interface.
The instance contains an executor thread-pool, thus care should be taken to ensure
the thread-pool is correctly managed. For example, try-with-resources could be used:

calculateAsync

Performs calculations asynchronously for a single set of market data,
invoking a listener as each calculation completes.

This method requires the listener to assemble the results, but it can be much more memory efficient when
calculating aggregate results. If the individual results are discarded after they are incorporated into
the aggregate they can be garbage collected.

Parameters:

tasks - the calculation tasks to invoke

marketData - the market data to be used in the calculations

refData - the reference data to be used in the calculations

listener - listener that is invoked when individual results are calculated

calculateMultiScenario

Performs calculations for multiple scenarios, each with a different set of market data.

This returns a grid of results based on the specified tasks and market data.
The grid will contain a row for each target and a column for each measure.
Each cell will contain multiple results, one for each scenario.

calculateMultiScenarioAsync

Performs calculations asynchronously for a multiple scenarios, each with a different set of market data,
invoking a listener as each calculation completes.

This method requires the listener to assemble the results, but it can be much more memory efficient when
calculating aggregate results. If the individual results are discarded after they are incorporated into
the aggregate they can be garbage collected.

Parameters:

tasks - the calculation tasks to invoke

marketData - the market data to be used in the calculations

refData - the reference data to be used in the calculations

listener - listener that is invoked when individual results are calculated