Interface NodalCurve
-
- All Superinterfaces:
Curve,ParameterizedData
- All Known Implementing Classes:
ConstantNodalCurve,HybridNodalCurve,InflationNodalCurve,InterpolatedNodalCurve
public interface NodalCurve extends Curve
A curve based ondoublenodal points.This provides access to a curve mapping a
doublex-value to adoubley-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 ParameterMetadatagetParameterMetadata(int parameterIndex)Gets the metadata of the parameter at the specified index.DoubleArraygetXValues()Gets the known x-values of the curve.DoubleArraygetYValues()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.NodalCurvewithMetadata(CurveMetadata metadata)Returns a new curve with the specified metadata.NodalCurvewithNode(double x, double y, ParameterMetadata paramMetadata)Returns a new curve with an additional node, specifying the parameter metadata.NodalCurvewithParameter(int parameterIndex, double newValue)Returns a copy of the data with the value at the specified index altered.default NodalCurvewithPerturbation(ParameterPerturbation perturbation)Returns a perturbed copy of the data.NodalCurvewithValues(DoubleArray xValues, DoubleArray yValues)Returns a new curve with the specified x-values and y-values.NodalCurvewithYValues(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:
withMetadatain 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,
SimpleCurveParameterMetadatawill be created.- Specified by:
getParameterMetadatain interfaceCurve- Specified by:
getParameterMetadatain 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
MapStreamkeyed 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:ParameterizedDataReturns 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:
withParameterin interfaceCurve- Specified by:
withParameterin 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:ParameterizedDataReturns 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:
withPerturbationin interfaceCurve- Specified by:
withPerturbationin 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
-
-