com.opengamma.strata.basics.value

Class ValueSchedule

• All Implemented Interfaces:
Serializable, Bean, ImmutableBean

public final class ValueSchedule
extends Object
implements ImmutableBean, 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 and 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 and 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 and Description
static ValueSchedule.Builder builder()
Returns a builder used to create an instance of the bean.
boolean equals(Object obj)
double getInitialValue()
Gets the initial value.
List<ValueStep> getSteps()
Gets the steps defining the change in the value.
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, List<ValueStep> steps)
Obtains an instance from an initial value and a list of changes.
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.
<R> Property<R> property(String propertyName)
Set<String> propertyNames()
List<Double> resolveValues(List<SchedulePeriod> periods)
Deprecated.
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.
String toString()
• Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait
• 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,
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

@Deprecated
public List<Double> resolveValues(List<SchedulePeriod> periods)
Deprecated.
Resolves the value and adjustments against a specific schedule.

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

Parameters:
periods - the list of schedule periods
Returns:
the values, one for each schedule period
• 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
• property

public <R> Property<R> property(String propertyName)
Specified by:
property in interface Bean
• propertyNames

public Set<String> propertyNames()
Specified by:
propertyNames 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 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 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(Object obj)
Overrides:
equals in class Object
• hashCode

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

public String toString()
Overrides:
toString in class Object