Class MutablePointSensitivities
- java.lang.Object
- 
- com.opengamma.strata.market.sensitivity.MutablePointSensitivities
 
- 
- All Implemented Interfaces:
- PointSensitivityBuilder
 
 public final class MutablePointSensitivities extends Object implements PointSensitivityBuilder Mutable builder for sensitivity to a group of curves.Contains a mutable list of point sensitivity objects, each referring to a specific point on a curve that was queried. The order of the list has no specific meaning, but does allow duplicates. This is a mutable builder that is not intended for use in multiple threads. It is intended to be used to create an immutable PointSensitivitiesinstance. Note that each individual point sensitivity implementation is immutable.
- 
- 
Constructor SummaryConstructors Constructor Description MutablePointSensitivities()Creates an empty instance.MutablePointSensitivities(PointSensitivity sensitivity)Creates an instance with the specified sensitivity.MutablePointSensitivities(List<? extends PointSensitivity> sensitivities)Creates an instance with the specified sensitivities.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description MutablePointSensitivitiesadd(PointSensitivity sensitivity)Adds a point sensitivity, mutating the internal list.MutablePointSensitivitiesaddAll(MutablePointSensitivities other)Merges the list of point sensitivities from another instance, mutating the internal list.MutablePointSensitivitiesaddAll(List<PointSensitivity> sensitivities)Adds a list of point sensitivities, mutating the internal list.PointSensitivitiesbuild()Builds the resulting point sensitivity.MutablePointSensitivitiesbuildInto(MutablePointSensitivities combination)Builds the point sensitivity, adding to the specified mutable instance.MutablePointSensitivitiescloned()Clones the point sensitivity builder.MutablePointSensitivitiescombinedWith(PointSensitivityBuilder other)Combines this sensitivity with another instance.booleanequals(Object obj)ImmutableList<PointSensitivity>getSensitivities()Gets the immutable list of point sensitivities.inthashCode()MutablePointSensitivitiesmapSensitivity(DoubleUnaryOperator operator)Returns an instance with the specified operation applied to the sensitivities in this builder.MutablePointSensitivitiesmultipliedBy(double factor)Multiplies the sensitivities in this builder by the specified factor.MutablePointSensitivitiesnormalize()Normalizes the point sensitivities by sorting and merging, mutating the internal list.intsize()Gets the number of sensitivity entries.MutablePointSensitivitiessort()Sorts the mutable list of point sensitivities.PointSensitivitiestoImmutable()Returns an immutable version of this object.StringtoString()MutablePointSensitivitieswithCurrency(Currency currency)Returns an instance with the specified currency applied to the sensitivities in this builder.
 
- 
- 
- 
Constructor Detail- 
MutablePointSensitivitiespublic MutablePointSensitivities() Creates an empty instance.
 - 
MutablePointSensitivitiespublic MutablePointSensitivities(PointSensitivity sensitivity) Creates an instance with the specified sensitivity.- Parameters:
- sensitivity- the sensitivity to add
 
 - 
MutablePointSensitivitiespublic MutablePointSensitivities(List<? extends PointSensitivity> sensitivities) Creates an instance with the specified sensitivities.- Parameters:
- sensitivities- the list of sensitivities, which is copied
 
 
- 
 - 
Method Detail- 
sizepublic int size() Gets the number of sensitivity entries.- Returns:
- the size of the internal list of point sensitivities
 
 - 
getSensitivitiespublic ImmutableList<PointSensitivity> getSensitivities() Gets the immutable list of point sensitivities.Each entry includes details of the curve it relates to. - Returns:
- the immutable list of sensitivities
 
 - 
addpublic MutablePointSensitivities add(PointSensitivity sensitivity) Adds a point sensitivity, mutating the internal list.This instance will be mutated, with the new sensitivity added at the end of the list. - Parameters:
- sensitivity- the sensitivity to add
- Returns:
- this, for method chaining
 
 - 
addAllpublic MutablePointSensitivities addAll(List<PointSensitivity> sensitivities) Adds a list of point sensitivities, mutating the internal list.This instance will be mutated, with the new sensitivities added at the end of the list. - Parameters:
- sensitivities- the sensitivities to add
- Returns:
- this, for method chaining
 
 - 
addAllpublic MutablePointSensitivities addAll(MutablePointSensitivities other) Merges the list of point sensitivities from another instance, mutating the internal list.This instance will be mutated, with the new sensitivities added at the end of the list. - Parameters:
- other- the other sensitivity to add
- Returns:
- this, for method chaining
 
 - 
withCurrencypublic MutablePointSensitivities withCurrency(Currency currency) Description copied from interface:PointSensitivityBuilderReturns an instance with the specified currency applied to the sensitivities in this builder.The result will consists of the same points, but with the sensitivity currency assigned. Builders may be mutable. Once this method is called, this instance must not be used. Instead, the result of the method must be used. - Specified by:
- withCurrencyin interface- PointSensitivityBuilder
- Parameters:
- currency- the currency to be applied to the sensitivities
- Returns:
- the resulting builder, replacing this builder
 
 - 
multipliedBypublic MutablePointSensitivities multipliedBy(double factor) Description copied from interface:PointSensitivityBuilderMultiplies the sensitivities in this builder by the specified factor.The result will consist of the same points, but with each sensitivity multiplied. Builders may be mutable. Once this method is called, this instance must not be used. Instead, the result of the method must be used. - Specified by:
- multipliedByin interface- PointSensitivityBuilder
- Parameters:
- factor- the multiplicative factor
- Returns:
- the resulting builder, replacing this builder
 
 - 
mapSensitivitypublic MutablePointSensitivities mapSensitivity(DoubleUnaryOperator operator) Description copied from interface:PointSensitivityBuilderReturns an instance with the specified operation applied to the sensitivities in this builder.The result will consist of the same points, but with the operator applied to each sensitivity. This is used to apply a mathematical operation to the sensitivities. For example, the operator could multiply the sensitivities by a constant, or take the inverse. inverse = base.mapSensitivities(value -> 1 / value); Builders may be mutable. Once this method is called, this instance must not be used. Instead, the result of the method must be used. - Specified by:
- mapSensitivityin interface- PointSensitivityBuilder
- Parameters:
- operator- the operator to be applied to the sensitivities
- Returns:
- the resulting builder, replacing this builder
 
 - 
combinedWithpublic MutablePointSensitivities combinedWith(PointSensitivityBuilder other) Description copied from interface:PointSensitivityBuilderCombines this sensitivity with another instance.This returns an instance with a combined list of point sensitivities. Builders may be mutable. Once this method is called, this instance must not be used. Instead, the result of the method must be used. - Specified by:
- combinedWithin interface- PointSensitivityBuilder
- Parameters:
- other- the other sensitivity builder
- Returns:
- the combined builder, replacing this builder and the specified builder
 
 - 
buildIntopublic MutablePointSensitivities buildInto(MutablePointSensitivities combination) Description copied from interface:PointSensitivityBuilderBuilds the point sensitivity, adding to the specified mutable instance.- Specified by:
- buildIntoin interface- PointSensitivityBuilder
- Parameters:
- combination- the combination object to add to
- Returns:
- the specified mutable point sensitivities instance is returned, for method chaining
 
 - 
buildpublic PointSensitivities build() Description copied from interface:PointSensitivityBuilderBuilds the resulting point sensitivity.This returns a PointSensitivitiesinstance.Builders may be mutable. Once this method is called, this instance must not be used. - Specified by:
- buildin interface- PointSensitivityBuilder
- Returns:
- the built combined sensitivity
 
 - 
clonedpublic MutablePointSensitivities cloned() Description copied from interface:PointSensitivityBuilderClones the point sensitivity builder.This returns a PointSensitivityBuilderinstance that is independent from the original. Immutable implementations may return themselves.Builders may be mutable. Using this method allows a copy of the original to be obtained, so both the original and the clone can be used. - Specified by:
- clonedin interface- PointSensitivityBuilder
- Returns:
- the built combined sensitivity
 
 - 
sortpublic MutablePointSensitivities sort() Sorts the mutable list of point sensitivities.Sorts the point sensitivities in this instance. - Returns:
- this, for method chaining
 
 - 
normalizepublic MutablePointSensitivities normalize() Normalizes the point sensitivities by sorting and merging, mutating the internal list.The list of sensitivities is sorted and then merged. Any two entries that represent the same curve query are merged. For example, if there are two point sensitivities that were created based on the same curve, currency and fixing date, then the entries are combined, summing the sensitivity value. The intention is that normalization occurs after gathering all the point sensitivities. - Specified by:
- normalizein interface- PointSensitivityBuilder
- Returns:
- this, for method chaining
 
 - 
toImmutablepublic PointSensitivities toImmutable() Returns an immutable version of this object.The result is an instance of the immutable PointSensitivities. It will contain the same individual point sensitivities.- Returns:
- the immutable sensitivity instance, not null
 
 
- 
 
-