Class ValueSchedule

• java.lang.Object
• com.opengamma.strata.basics.value.ValueSchedule
• All Implemented Interfaces:
java.io.Serializable, Bean, ImmutableBean

public final class ValueSchedule
extends java.lang.Object
implements ImmutableBean, java.io.Serializable
A value that can vary over time.

This represents a single initial value and any adjustments over the lifetime of a trade. Adjustments may be specified in absolute or relative terms.

The adjustments may be specified as individual steps or as a sequence of steps. An individual step is a change that occurs at a specific date, identified either by the date or the index within the schedule. A sequence of steps consists of a start date, end date and frequency, with the same change applying many times. All changes must occur on dates that are period boundaries in the specified schedule.

It is possible to specify both individual steps and a sequence, however this is not recommended. It it is done, then the individual steps and sequence steps must resolve to different dates.

The value is specified as a double with the context adding additional meaning. If the value represents an amount of money then the currency is specified separately. If the value represents a rate then a 5% rate is expressed as 0.05.

Serialized Form
• Nested Class Summary

Nested Classes
Modifier and Type Class Description
static class  ValueSchedule.Builder
The bean-builder for ValueSchedule.
static class  ValueSchedule.Meta
The meta-bean for ValueSchedule.
• Field Summary

Fields
Modifier and Type Field Description
static ValueSchedule ALWAYS_0
A value schedule that always has the value zero.
static ValueSchedule ALWAYS_1
A value schedule that always has the value one.
• Method Summary

All Methods
Modifier and Type Method Description
static ValueSchedule.Builder builder()
Returns a builder used to create an instance of the bean.
boolean equals​(java.lang.Object obj)
double getInitialValue()
Gets the initial value.
java.util.List<ValueStep> getSteps()
Gets the steps defining the change in the value.
java.util.Optional<ValueStepSequence> getStepSequence()
Gets the sequence of steps changing the value.
int hashCode()
static ValueSchedule.Meta meta()
The meta-bean for ValueSchedule.
ValueSchedule.Meta metaBean()
static ValueSchedule of​(double value)
Obtains an instance from a single value that does not change over time.
static ValueSchedule of​(double initialValue, ValueStep... steps)
Obtains an instance from an initial value and a list of changes.
static ValueSchedule of​(double initialValue, ValueStepSequence stepSequence)
Obtains an instance from an initial value and a sequence of steps.
static ValueSchedule of​(double initialValue, java.util.List<ValueStep> steps)
Obtains an instance from an initial value and a list of changes.
DoubleArray resolveValues​(Schedule schedule)
Resolves the value and adjustments against a specific schedule.
ValueSchedule.Builder toBuilder()
Returns a builder that allows this bean to be mutated.
java.lang.String toString()
• Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait
• Methods inherited from interface org.joda.beans.Bean

property, propertyNames
• Field Detail

• ALWAYS_0

public static final ValueSchedule ALWAYS_0
A value schedule that always has the value zero.
• ALWAYS_1

public static final ValueSchedule ALWAYS_1
A value schedule that always has the value one.
• Method Detail

• of

public static ValueSchedule of​(double value)
Obtains an instance from a single value that does not change over time.
Parameters:
value - a single value that does not change over time
Returns:
the value schedule
• of

public static ValueSchedule of​(double initialValue,
ValueStep... steps)
Obtains an instance from an initial value and a list of changes.

Each step fully defines a single change in the value. The date of each change can be specified as an absolute date or in relative terms.

Parameters:
initialValue - the initial value used for the first period
steps - the full definition of how the value changes over time
Returns:
the value schedule
• of

public static ValueSchedule of​(double initialValue,
java.util.List<ValueStep> steps)
Obtains an instance from an initial value and a list of changes.

Each step fully defines a single change in the value. The date of each change can be specified as an absolute date or in relative terms.

Parameters:
initialValue - the initial value used for the first period
steps - the full definition of how the value changes over time
Returns:
the value schedule
• of

public static ValueSchedule of​(double initialValue,
ValueStepSequence stepSequence)
Obtains an instance from an initial value and a sequence of steps.

The sequence defines changes from one date to another date using a frequency. For example, the value might change every year from 2011-06-01 to 2015-06-01.

Parameters:
initialValue - the initial value used for the first period
stepSequence - the full definition of how the value changes over time
Returns:
the value schedule
• resolveValues

public DoubleArray resolveValues​(Schedule schedule)
Resolves the value and adjustments against a specific schedule.

This converts a schedule into a list of values, one for each schedule period.

Parameters:
schedule - the schedule
Returns:
the values, one for each schedule period
• meta

public static ValueSchedule.Meta meta()
The meta-bean for ValueSchedule.
Returns:
the meta-bean, not null
• builder

public static ValueSchedule.Builder builder()
Returns a builder used to create an instance of the bean.
Returns:
the builder, not null
• metaBean

public ValueSchedule.Meta metaBean()
Specified by:
metaBean in interface Bean
• getInitialValue

public double getInitialValue()
Gets the initial value.

This is used for the lifetime of the trade unless specifically varied.

Returns:
the value of the property
• getSteps

public java.util.List<ValueStep> getSteps()
Gets the steps defining the change in the value.

Each step consists of a key locating the date of the change and the adjustment that occurs.

Returns:
the value of the property, not null
• getStepSequence

public java.util.Optional<ValueStepSequence> getStepSequence()
Gets the sequence of steps changing the value.

This allows a regular pattern of steps to be encoded. All step dates must be unique, thus the list of steps must not contain any date implied by this sequence.

Returns:
the optional value of the property, not null
• toBuilder

public ValueSchedule.Builder toBuilder()
Returns a builder that allows this bean to be mutated.
Returns:
the mutable builder, not null
• equals

public boolean equals​(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
• hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
• toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object