Package com.opengamma.strata.calc.runner
Class CalculationTask
- java.lang.Object
-
- com.opengamma.strata.calc.runner.CalculationTask
-
- All Implemented Interfaces:
org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class CalculationTask extends Object implements org.joda.beans.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 singleCalculationTarget
. When invoked, it will calculate a result for one or more columns in the grid of results.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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()
Gets the additional parameters.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 org.joda.beans.TypedMetaBean<CalculationTask>
meta()
The meta-bean forCalculationTask
.org.joda.beans.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()
-
-
-
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 calculatedfunction
- the function that performs the calculationcells
- the cells to be calculated by this task- Returns:
- the task
-
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 calculatedfunction
- the function that performs the calculationparameters
- the additional parameterscells
- the cells to be calculated by this task- Returns:
- the task
-
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 calculationrefData
- the reference data- Returns:
- results of the calculation, one for every scenario in the market data
-
meta
public static org.joda.beans.TypedMetaBean<CalculationTask> meta()
The meta-bean forCalculationTask
.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<CalculationTask> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.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()
Gets the additional parameters.- 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
-
-