public enum ValueAdjustmentType extends Enum<ValueAdjustmentType> implements NamedEnum
A double value can be transformed into another value in various different ways.
Each type is a function of two values, the base value and the modifying value.
Each type represents a different way to express the same concept. For example, here is how an increase from 200 to 220 could be represented:
| 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 |
| Enum Constant and Description |
|---|
DELTA_AMOUNT
Calculates the result by treating the modifying value as a delta, adding it to the base value.
|
DELTA_MULTIPLIER
Calculates the result by treating the modifying value as a multiplication factor, adding it to the base value.
|
MULTIPLIER
Calculates the result by treating the modifying value as a multiplication factor to apply to the base value.
|
REPLACE
The modifying value replaces the base value.
|
| Modifier and Type | Method and Description |
|---|---|
abstract double |
adjust(double baseValue,
double modifyingValue)
Adjusts the base value based on the type and the modifying value.
|
static ValueAdjustmentType |
of(String name)
Obtains an instance from the specified name.
|
String |
toString()
Returns the formatted name of the type.
|
static ValueAdjustmentType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ValueAdjustmentType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ValueAdjustmentType REPLACE
The result is modifyingValue.
public static final ValueAdjustmentType DELTA_AMOUNT
The result is (baseValue + modifyingValue).
This adjustment type can be referred to as an absolute shift.
public static final ValueAdjustmentType DELTA_MULTIPLIER
The result is (baseValue + baseValue * modifyingValue).
This adjustment type can be referred to as a relative shift.
public static final ValueAdjustmentType MULTIPLIER
The result is (baseValue * modifyingValue).
public static ValueAdjustmentType[] values()
for (ValueAdjustmentType c : ValueAdjustmentType.values()) System.out.println(c);
public static ValueAdjustmentType valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static ValueAdjustmentType of(String name)
Parsing handles the mixed case form produced by toString() and
the upper and lower case variants of the enum constant name.
name - the name to parseIllegalArgumentException - if the name is not knownpublic abstract double adjust(double baseValue,
double modifyingValue)
baseValue - the base, or previous, value to be adjustedmodifyingValue - the value that the type uses to modify the base valuepublic String toString()
toString in class Enum<ValueAdjustmentType>Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.