Interface NodalCurve
-
- All Superinterfaces:
Curve
,ParameterizedData
- All Known Implementing Classes:
ConstantNodalCurve
,HybridNodalCurve
,InflationNodalCurve
,InterpolatedNodalCurve
public interface NodalCurve extends Curve
A curve based ondouble
nodal points.This provides access to a curve mapping a
double
x-value to adouble
y-value.The parameters of an x-y curve are the x-y values. The values themselves are returned by
getXValues()
andgetYValues()
. The metadata is returned byCurve.getMetadata()
.- See Also:
InterpolatedNodalCurve
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ParameterMetadata
getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.DoubleArray
getXValues()
Gets the known x-values of the curve.DoubleArray
getYValues()
Gets the known y-values of the curve.default MapStream<Double,Double>
values()
Converts this instance to a stream of y-values, keyed by the x-values.NodalCurve
withMetadata(CurveMetadata metadata)
Returns a new curve with the specified metadata.NodalCurve
withNode(double x, double y, ParameterMetadata paramMetadata)
Returns a new curve with an additional node, specifying the parameter metadata.NodalCurve
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.default NodalCurve
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.NodalCurve
withValues(DoubleArray xValues, DoubleArray yValues)
Returns a new curve with the specified x-values and y-values.NodalCurve
withYValues(DoubleArray values)
Returns a new curve with the specified values.-
Methods inherited from interface com.opengamma.strata.market.curve.Curve
createParameterSensitivity, createParameterSensitivity, findParameterIndex, firstDerivative, getMetadata, getName, split, withUnderlyingCurve, yValue, yValueParameterSensitivity
-
Methods inherited from interface com.opengamma.strata.market.param.ParameterizedData
getParameter, getParameterCount
-
-
-
-
Method Detail
-
withMetadata
NodalCurve withMetadata(CurveMetadata metadata)
Returns a new curve with the specified metadata.This allows the metadata of the curve to be changed while retaining all other information. If parameter metadata is present, the size of the list must match the number of parameters of this curve.
- Specified by:
withMetadata
in interfaceCurve
- Parameters:
metadata
- the new metadata for the curve- Returns:
- the new curve
-
getParameterMetadata
default ParameterMetadata getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.If there is no specific parameter metadata,
SimpleCurveParameterMetadata
will be created.- Specified by:
getParameterMetadata
in interfaceCurve
- Specified by:
getParameterMetadata
in interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the metadata of the parameter
- Throws:
IndexOutOfBoundsException
- if the index is invalid
-
getXValues
DoubleArray getXValues()
Gets the known x-values of the curve.This method returns the fixed x-values used to define the curve. This will be of the same size as the y-values.
- Returns:
- the x-values
-
getYValues
DoubleArray getYValues()
Gets the known y-values of the curve.This method returns the fixed y-values used to define the curve. This will be of the same size as the x-values.
- Returns:
- the y-values
-
withYValues
NodalCurve withYValues(DoubleArray values)
Returns a new curve with the specified values.This allows the y-values of the curve to be changed while retaining the same x-values.
- Parameters:
values
- the new y-values for the curve- Returns:
- the new curve
-
withValues
NodalCurve withValues(DoubleArray xValues, DoubleArray yValues)
Returns a new curve with the specified x-values and y-values.This allows the x values and y-values of the curve to be changed.
- Parameters:
xValues
- the new x-values for the curveyValues
- the new y-values for the curve- Returns:
- the new curve
-
values
default MapStream<Double,Double> values()
Converts this instance to a stream of y-values, keyed by the x-values.This returns a
MapStream
keyed by the x-values.- Returns:
- a map stream containing the x-values and the y-values
-
withParameter
NodalCurve withParameter(int parameterIndex, double newValue)
Description copied from interface:ParameterizedData
Returns a copy of the data with the value at the specified index altered.This instance is immutable and unaffected by this method call.
- Specified by:
withParameter
in interfaceCurve
- Specified by:
withParameter
in interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to getnewValue
- the new value for the specified parameter- Returns:
- a parameterized data instance based on this with the specified parameter altered
-
withPerturbation
default NodalCurve withPerturbation(ParameterPerturbation perturbation)
Description copied from interface:ParameterizedData
Returns a perturbed copy of the data.The perturbation instance will be invoked once for each parameter in this instance, returning the perturbed value for that parameter. The result of this method is a new instance that is based on those perturbed values.
This instance is immutable and unaffected by this method call.
- Specified by:
withPerturbation
in interfaceCurve
- Specified by:
withPerturbation
in interfaceParameterizedData
- Parameters:
perturbation
- the perturbation to apply- Returns:
- a parameterized data instance based on this with the specified perturbation applied
-
withNode
NodalCurve withNode(double x, double y, ParameterMetadata paramMetadata)
Returns a new curve with an additional node, specifying the parameter metadata.The result will contain the specified node. If the x-value equals an existing x-value, the y-value will be changed. If the x-value does not equal an existing x-value, the node will be added.
The result will only contain the specified parameter metadata if this curve also has parameter meta-data.
- Parameters:
x
- the new x-valuey
- the new y-valueparamMetadata
- the new parameter metadata- Returns:
- the updated curve
-
-