public final class ValueAdjustment extends Object implements org.joda.beans.ImmutableBean, Serializable
A base value, represented as a double, can be transformed into another value
by specifying the result (absolute) or the calculation (relative).
| Type | baseValue | modifyingValue | Calculation |
|---|---|---|---|
| Replace | 200 | 220 | result = modifyingValue = 220 |
| DeltaAmount | 200 | 20 | result = baseValue + modifyingValue = (200 + 20) = 220 |
| DeltaMultiplier | 200 | 0.1 | result = baseValue + baseValue * modifyingValue = (200 + 200 * 0.1) = 220 |
| Multiplier | 200 | 1.1 | result = baseValue * modifyingValue = (200 * 1.1) = 220 |
| Modifier and Type | Class and Description |
|---|---|
static class |
ValueAdjustment.Meta
The meta-bean for
ValueAdjustment. |
| Modifier and Type | Field and Description |
|---|---|
static ValueAdjustment |
NONE
An instance that makes no adjustment to the value.
|
| Modifier and Type | Method and Description |
|---|---|
double |
adjust(double baseValue)
Adjusts the base value based on the criteria of this adjustment.
|
boolean |
equals(Object obj) |
double |
getModifyingValue()
Gets the value used to modify the base value.
|
ValueAdjustmentType |
getType()
Gets the type of adjustment to make.
|
int |
hashCode() |
static ValueAdjustment.Meta |
meta()
The meta-bean for
ValueAdjustment. |
ValueAdjustment.Meta |
metaBean() |
static ValueAdjustment |
ofDeltaAmount(double deltaAmount)
Obtains an instance specifying an amount to add to the base value.
|
static ValueAdjustment |
ofDeltaMultiplier(double deltaMultiplier)
Obtains an instance specifying a multiplication factor, adding it to the base value.
|
static ValueAdjustment |
ofMultiplier(double multiplier)
Obtains an instance specifying a multiplication factor to apply to the base value.
|
static ValueAdjustment |
ofReplace(double replacementValue)
Obtains an instance that replaces the base value.
|
String |
toString() |
public static final ValueAdjustment NONE
public static ValueAdjustment ofReplace(double replacementValue)
The base value is ignored when calculating the result.
replacementValue - the replacement value to use as the result of the adjustmentpublic static ValueAdjustment ofDeltaAmount(double deltaAmount)
The result will be (baseValue + deltaAmount).
deltaAmount - the amount to be added to the base valuepublic static ValueAdjustment ofDeltaMultiplier(double deltaMultiplier)
The result will be (baseValue + baseValue * modifyingValue).
deltaMultiplier - the multiplication factor to apply to the base amount
with the result added to the base amountpublic static ValueAdjustment ofMultiplier(double multiplier)
The result will be (baseValue * modifyingValue).
multiplier - the multiplication factor to apply to the base amountpublic double adjust(double baseValue)
For example, if this adjustment represents a 10% decrease, then the result will be the base value minus 10%.
baseValue - the base, or previous, value to be adjustedpublic static ValueAdjustment.Meta meta()
ValueAdjustment.public ValueAdjustment.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic double getModifyingValue()
public ValueAdjustmentType getType()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.