com.opengamma.strata.calc.runner

• All Implemented Interfaces:
Bean, ImmutableBean

public final class CalculationTask
extends Object
implements ImmutableBean
A single task that will be used to perform a calculation.

This is a single unit of execution in the calculation runner. It consists of a CalculationFunction and the appropriate inputs, including a single CalculationTarget. When invoked, it will calculate a result for one or more columns in the grid of results.

• ### Method Summary

All Methods
Modifier and Type Method and Description
boolean equals(Object obj)
CalculationResults execute(ScenarioMarketData marketData, ReferenceData refData)
Executes the task, performing calculations for the target using multiple sets of market data.
List<CalculationTaskCell> getCells()
Gets the cells to be calculated.
CalculationFunction<CalculationTarget> getFunction()
Gets the function that will calculate the value.
Set<Measure> getMeasures()
Gets the set of measures that will be calculated by this task.
CalculationParameters getParameters()
int getRowIndex()
Gets the index of the row in the grid of results.
CalculationTarget getTarget()
Gets the target for which the value will be calculated.
int hashCode()
static TypedMetaBean<CalculationTask> meta()
The meta-bean for CalculationTask.
TypedMetaBean<CalculationTask> metaBean()
Currency naturalCurrency(ReferenceData refData)
Determines the natural currency of the target.
static CalculationTask of(CalculationTarget target, CalculationFunction<? extends CalculationTarget> function, CalculationParameters parameters, List<CalculationTaskCell> cells)
Obtains an instance that will calculate the specified cells.
static CalculationTask of(CalculationTarget target, CalculationFunction<? extends CalculationTarget> function, CalculationTaskCell... cells)
Obtains an instance that will calculate the specified cells.
MarketDataRequirements requirements(ReferenceData refData)
Returns requirements specifying the market data the function needs to perform its calculations.
String toString()
• ### Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait
• ### Methods inherited from interface org.joda.beans.Bean

property, propertyNames
• ### Method Detail

• #### of

public static CalculationTask of(CalculationTarget target,
CalculationFunction<? extends CalculationTarget> function,
CalculationTaskCell... cells)
Obtains an instance that will calculate the specified cells.

The cells must all be for the same row index and none of the column indices must overlap. The result will contain no calculation parameters.

Parameters:
target - the target for which the value will be calculated
function - the function that performs the calculation
cells - the cells to be calculated by this task
Returns:
• #### of

public static CalculationTask of(CalculationTarget target,
CalculationFunction<? extends CalculationTarget> function,
CalculationParameters parameters,
List<CalculationTaskCell> cells)
Obtains an instance that will calculate the specified cells.

The cells must all be for the same row index and none of the column indices must overlap.

Parameters:
target - the target for which the value will be calculated
function - the function that performs the calculation
parameters - the additional parameters
cells - the cells to be calculated by this task
Returns:
• #### getRowIndex

public int getRowIndex()
Gets the index of the row in the grid of results.
Returns:
the row index
• #### getMeasures

public Set<Measure> getMeasures()
Gets the set of measures that will be calculated by this task.
Returns:
the measures
• #### requirements

public MarketDataRequirements requirements(ReferenceData refData)
Returns requirements specifying the market data the function needs to perform its calculations.
Parameters:
refData - the reference data
Returns:
requirements specifying the market data the function needs to perform its calculations
• #### naturalCurrency

public Currency naturalCurrency(ReferenceData refData)
Determines the natural currency of the target.

This is only called for measures that are currency convertible.

Parameters:
refData - the reference data
Returns:
the natural currency
• #### execute

public CalculationResults execute(ScenarioMarketData marketData,
ReferenceData refData)
Executes the task, performing calculations for the target using multiple sets of market data.

This invokes the function with the correct set of market data.

Parameters:
marketData - the market data used in the calculation
refData - the reference data
Returns:
results of the calculation, one for every scenario in the market data
• #### toString

public String toString()
Overrides:
toString in class Object
• #### meta

public static TypedMetaBean<CalculationTask> meta()
The meta-bean for CalculationTask.
Returns:
the meta-bean, not null
• #### metaBean

public TypedMetaBean<CalculationTask> metaBean()
Specified by:
metaBean in interface Bean
• #### getTarget

public CalculationTarget getTarget()
Gets the target for which the value will be calculated. This is typically a trade.
Returns:
the value of the property, not null
• #### getFunction

public CalculationFunction<CalculationTarget> getFunction()
Gets the function that will calculate the value.
Returns:
the value of the property, not null
• #### getParameters

public CalculationParameters getParameters()
Returns:
the value of the property, not null
• #### getCells

public List<CalculationTaskCell> getCells()
Gets the cells to be calculated.
Returns:
the value of the property, not empty
• #### equals

public boolean equals(Object obj)
Overrides:
equals in class Object
• #### hashCode

public int hashCode()
Overrides:
hashCode in class Object