Class CalculationResult
- java.lang.Object
-
- com.opengamma.strata.calc.runner.CalculationResult
-
- All Implemented Interfaces:
Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class CalculationResult extends Object implements org.joda.beans.ImmutableBean, Serializable
The result of a single calculation.This stores the calculated result for a single cell in the output grid. A set of related results for a single target can be stored in a
CalculationResults
instance.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
getColumnIndex()
Gets the column index of the value in the results grid.Result<?>
getResult()
Gets the result of the calculation.<T> Result<T>
getResult(Class<T> type)
Gets the result of the calculation, casting the result to a known type.int
getRowIndex()
Gets the row index of the value in the results grid.int
hashCode()
static org.joda.beans.TypedMetaBean<CalculationResult>
meta()
The meta-bean forCalculationResult
.org.joda.beans.TypedMetaBean<CalculationResult>
metaBean()
static CalculationResult
of(int rowIndex, int columnIndex, Result<?> result)
Obtains an instance for the specified row and column index in the output grid.String
toString()
CalculationResult
withResult(Result<?> underlyingResult)
Returns a copy of this result with the underlying result updated.
-
-
-
Method Detail
-
of
public static CalculationResult of(int rowIndex, int columnIndex, Result<?> result)
Obtains an instance for the specified row and column index in the output grid.The
Result
object captures the result value, or the failure that prevented the result from being calculated.- Parameters:
rowIndex
- the row index of the value in the results gridcolumnIndex
- the column index of the value in the results gridresult
- the result of the calculation- Returns:
- a calculation result containing the row index, column index and result object
-
getResult
public <T> Result<T> getResult(Class<T> type)
Gets the result of the calculation, casting the result to a known type.The result may be a single value or a multi-scenario value. A multi-scenario value will implement
ScenarioArray
unless it has been aggregated.If the calculation did not complete successfully, a failure result will be returned explaining the problem. Callers must check whether the result is a success or failure before examining the result value.
- Type Parameters:
T
- the result type- Parameters:
type
- the result type- Returns:
- the result, cast to the specified type
- Throws:
ClassCastException
- if the result is not of the specified type
-
withResult
public CalculationResult withResult(Result<?> underlyingResult)
Returns a copy of this result with the underlying result updated.- Parameters:
underlyingResult
- the new underlying result- Returns:
- a new instance with the result updated
-
meta
public static org.joda.beans.TypedMetaBean<CalculationResult> meta()
The meta-bean forCalculationResult
.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<CalculationResult> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getRowIndex
public int getRowIndex()
Gets the row index of the value in the results grid.- Returns:
- the value of the property
-
getColumnIndex
public int getColumnIndex()
Gets the column index of the value in the results grid.- Returns:
- the value of the property
-
getResult
public Result<?> getResult()
Gets the result of the calculation.The result may be a single value or a multi-scenario value. A multi-scenario value will implement
ScenarioArray
unless it has been aggregated.If the calculation did not complete successfully, a failure result will be returned explaining the problem. Callers must check whether the result is a success or failure before examining the result value.
- Returns:
- the value of the property, not null
-
-