Class UnitParameterSensitivities
- java.lang.Object
-
- com.opengamma.strata.market.param.UnitParameterSensitivities
-
- All Implemented Interfaces:
Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class UnitParameterSensitivities extends Object implements org.joda.beans.ImmutableBean, Serializable
Unit parameter sensitivity for parameterized market data, such as curves.Parameter sensitivity is the sensitivity of a value to the parameters of parameterized market data objects that are used to determine the value. Common
ParameterizedData
implementations includeCurve
andSurface
.For example, par rate sensitivity to an underlying curve would be expressed using this class as there is no associated currency.
The sensitivity is expressed as a single entry for piece of parameterized market data. The sensitivity has no associated currency. The order of the list has no specific meaning.
One way of viewing this class is as a
Map
from a specific sensitivity key toDoubleArray
sensitivity values. However, instead of being structured as aMap
, the data is structured as aList
, with the key and value in each entry.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UnitParameterSensitivities.Meta
The meta-bean forUnitParameterSensitivities
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UnitParameterSensitivities
combinedWith(UnitParameterSensitivities other)
Combines this parameter sensitivities with another instance.UnitParameterSensitivities
combinedWith(UnitParameterSensitivity other)
Combines this parameter sensitivities with another instance.static UnitParameterSensitivities
empty()
An empty sensitivity instance.boolean
equals(Object obj)
boolean
equalWithTolerance(UnitParameterSensitivities other, double tolerance)
Checks if this sensitivity equals another within the specified tolerance.Optional<UnitParameterSensitivity>
findSensitivity(MarketDataName<?> name)
Finds a single sensitivity instance by name.ImmutableList<UnitParameterSensitivity>
getSensitivities()
Gets the parameter sensitivities.UnitParameterSensitivity
getSensitivity(MarketDataName<?> name)
Gets a single sensitivity instance by name.int
hashCode()
UnitParameterSensitivities
mapSensitivities(DoubleUnaryOperator operator)
Returns an instance with the specified operation applied to the sensitivity values.static UnitParameterSensitivities.Meta
meta()
The meta-bean forUnitParameterSensitivities
.UnitParameterSensitivities.Meta
metaBean()
UnitParameterSensitivities
multipliedBy(double factor)
Returns an instance with the sensitivity values multiplied by the specified factor.CurrencyParameterSensitivities
multipliedBy(Currency currency, double amount)
Converts this sensitivity to a monetary value, multiplying by the specified factor.static UnitParameterSensitivities
of(UnitParameterSensitivity sensitivity)
Obtains an instance from a single sensitivity entry.static UnitParameterSensitivities
of(UnitParameterSensitivity... sensitivities)
Obtains an instance from an array of sensitivity entries.static UnitParameterSensitivities
of(List<? extends UnitParameterSensitivity> sensitivities)
Obtains an instance from a list of sensitivity entries.int
size()
Gets the number of sensitivity entries.UnitParameterSensitivities
split()
Splits this sensitivity instance.String
toString()
-
-
-
Method Detail
-
empty
public static UnitParameterSensitivities empty()
An empty sensitivity instance.- Returns:
- the empty instance
-
of
public static UnitParameterSensitivities of(UnitParameterSensitivity sensitivity)
Obtains an instance from a single sensitivity entry.- Parameters:
sensitivity
- the sensitivity entry- Returns:
- the sensitivities instance
-
of
public static UnitParameterSensitivities of(UnitParameterSensitivity... sensitivities)
Obtains an instance from an array of sensitivity entries.The order of sensitivities is typically unimportant, however it is retained and exposed in
equals(Object)
.- Parameters:
sensitivities
- the sensitivities- Returns:
- the sensitivities instance
-
of
public static UnitParameterSensitivities of(List<? extends UnitParameterSensitivity> sensitivities)
Obtains an instance from a list of sensitivity entries.The order of sensitivities is typically unimportant, however it is retained and exposed in
equals(Object)
.- Parameters:
sensitivities
- the list of sensitivity entries- Returns:
- the sensitivities instance
-
size
public int size()
Gets the number of sensitivity entries.- Returns:
- the size of the internal list of point sensitivities
-
getSensitivity
public UnitParameterSensitivity getSensitivity(MarketDataName<?> name)
Gets a single sensitivity instance by name.- Parameters:
name
- the curve name to find- Returns:
- the matching sensitivity
- Throws:
IllegalArgumentException
- if the name and currency do not match an entry
-
findSensitivity
public Optional<UnitParameterSensitivity> findSensitivity(MarketDataName<?> name)
Finds a single sensitivity instance by name.If the sensitivity is not found, optional empty is returned.
- Parameters:
name
- the curve name to find- Returns:
- the matching sensitivity
-
combinedWith
public UnitParameterSensitivities combinedWith(UnitParameterSensitivity other)
Combines this parameter sensitivities with another instance.This returns a new sensitivity instance with the specified sensitivity added. This instance is immutable and unaffected by this method. The result may contain duplicate parameter sensitivities.
- Parameters:
other
- the other parameter sensitivity- Returns:
- an instance based on this one, with the other instance added
-
combinedWith
public UnitParameterSensitivities combinedWith(UnitParameterSensitivities other)
Combines this parameter sensitivities with another instance.This returns a new sensitivity instance with a combined list of parameter sensitivities. This instance is immutable and unaffected by this method. The result may contain duplicate parameter sensitivities.
- Parameters:
other
- the other parameter sensitivities- Returns:
- an instance based on this one, with the other instance added
-
multipliedBy
public CurrencyParameterSensitivities multipliedBy(Currency currency, double amount)
Converts this sensitivity to a monetary value, multiplying by the specified factor.The result will consist of the entries based on the entries of this instance. Each entry in the result will be in the specified currency and multiplied by the specified amount.
- Parameters:
currency
- the currency of the amountamount
- the amount to multiply by- Returns:
- the resulting sensitivity object
-
multipliedBy
public UnitParameterSensitivities multipliedBy(double factor)
Returns an instance with the sensitivity values multiplied by the specified factor.The result will consist of the same entries, but with each sensitivity value multiplied. This instance is immutable and unaffected by this method.
- Parameters:
factor
- the multiplicative factor- Returns:
- an instance based on this one, with each sensitivity multiplied by the factor
-
mapSensitivities
public UnitParameterSensitivities mapSensitivities(DoubleUnaryOperator operator)
Returns an instance with the specified operation applied to the sensitivity values.The result will consist of the same entries, but with the operator applied to each sensitivity value. This instance is immutable and unaffected by this method.
This is used to apply a mathematical operation to the sensitivity values. For example, the operator could multiply the sensitivities by a constant, or take the inverse.
inverse = base.mapSensitivities(value -> 1 / value);
- Parameters:
operator
- the operator to be applied to the sensitivities- Returns:
- an instance based on this one, with the operator applied to the sensitivity values
-
split
public UnitParameterSensitivities split()
Splits this sensitivity instance.This examines each individual sensitivity to see if it can be
split
. If any can be split, the result will contain the combination of the split sensitivities.- Returns:
- this sensitivity, with any combined sensitivities split
-
equalWithTolerance
public boolean equalWithTolerance(UnitParameterSensitivities other, double tolerance)
Checks if this sensitivity equals another within the specified tolerance.This returns true if the two instances have the same keys, with arrays of the same length, where the
double
values are equal within the specified tolerance.- Parameters:
other
- the other sensitivitytolerance
- the tolerance- Returns:
- true if equal up to the tolerance
-
meta
public static UnitParameterSensitivities.Meta meta()
The meta-bean forUnitParameterSensitivities
.- Returns:
- the meta-bean, not null
-
metaBean
public UnitParameterSensitivities.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getSensitivities
public ImmutableList<UnitParameterSensitivity> getSensitivities()
Gets the parameter sensitivities.Each entry includes details of the
ParameterizedData
it relates to.- Returns:
- the value of the property, not null
-
-