public interface CalculationFunctions
This provides the complete set of functions that will be used in a calculation.
The default implementation is accessed by the static factory methods.
It matches the CalculationFunction
by the type of the CalculationTarget
.
As such, the default implementation is essentially a Map
where the keys are the
target type Class
that the function operates on.
Modifier and Type  Method and Description 

default CalculationFunctions 
composedWith(CalculationFunctions other)
Returns a set of calculation functions which combines the functions in this set with the functions in another.

default CalculationFunctions 
composedWith(DerivedCalculationFunction<?,?>... functions)
Returns a set of calculation functions which combines the functions in this set with some
derived calculation functions.

static CalculationFunctions 
empty()
Obtains an empty instance with no functions.

<T extends CalculationTarget> 
findFunction(T target)
Finds the function that handles the specified target.

default <T extends CalculationTarget> 
getFunction(T target)
Gets the function that handles the specified target.

static CalculationFunctions 
of(CalculationFunction<?>... functions)
Obtains an instance from the specified functions.

static CalculationFunctions 
of(List<? extends CalculationFunction<?>> functions)
Obtains an instance from the specified functions.

static CalculationFunctions 
of(Map<Class<?>,? extends CalculationFunction<?>> functions)
Obtains an instance from the specified functions.

static CalculationFunctions empty()
static CalculationFunctions of(CalculationFunction<?>... functions)
This returns an implementation that matches the function by the type of the
target, as returned by CalculationFunction.targetType()
.
The list will be converted to a Map
keyed by the target type.
Each function must refer to a different target type.
functions
 the functionsstatic CalculationFunctions of(List<? extends CalculationFunction<?>> functions)
This returns an implementation that matches the function by the type of the
target, as returned by CalculationFunction.targetType()
.
The list will be converted to a Map
keyed by the target type.
Each function must refer to a different target type.
functions
 the functionsstatic CalculationFunctions of(Map<Class<?>,? extends CalculationFunction<?>> functions)
This returns an implementation that matches the function by the type of the target.
When finding the matching function, the target type is looked up in the specified map.
The map will be validated to ensure the Class
is consistent with
CalculationFunction.targetType()
.
functions
 the functionsdefault <T extends CalculationTarget> CalculationFunction<? super T> getFunction(T target)
If no function is found, a suitable default that can perform no calculations is provided.
T
 the target typetarget
 the calculation target, such as a trade<T extends CalculationTarget> Optional<CalculationFunction<? super T>> findFunction(T target)
If no function is found the result is empty.
T
 the target typetarget
 the calculation target, such as a tradedefault CalculationFunctions composedWith(CalculationFunctions other)
If both sets of functions contain a function for a target then the function from this set is returned.
other
 another set of calculation functionsdefault CalculationFunctions composedWith(DerivedCalculationFunction<?,?>... functions)
Each derived function calculates one measure for one type of target, possibly using other calculated measures as inputs.
If any of the derived functions depend on each other they must be passed to this method in the correct
order to ensure their dependencies can be satisfied. For example, if there is a derived function
fnA
which depends on the measure calculated by function fnB
they must be passed to
this method in the order fnB, fnA
.
functions
 the functionsCopyright 2009Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.