- java.lang.Object
-
- net.finmath.marketdata.model.curves.AbstractCurve
-
- net.finmath.marketdata.model.curves.PiecewiseCurve
-
- All Implemented Interfaces:
Serializable,Cloneable,ParameterObject,Curve
- Direct Known Subclasses:
ForwardCurveWithFixings
public class PiecewiseCurve extends AbstractCurve implements Curve
A piecewise curve. The curve consists of a base curve and a second curve. If thetimeparameter of thegetValue(AnalyticModel, double)method falls inside a pre-defined open interval, it is delegated to the second curve, otherwise it is delegated to the base curve.- Version:
- 1.0
- Author:
- Christian Fries
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPiecewiseCurve.BuilderA builder (following the builder pattern) for PiecewiseCurve objects.
-
Constructor Summary
Constructors Constructor Description PiecewiseCurve(Curve curve, Curve fixedPartCurve, double fixedPartStartTime, double fixedPartEndTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PiecewiseCurveclone()Create a deep copied clone.CurvegetBaseCurve()PiecewiseCurve.BuildergetCloneBuilder()Returns a curve builder bases on a clone of this curve.CurvegetCloneForParameter(double[] value)Create a clone with a modified parameter.CurvegetFixedPartCurve()doublegetFixedPartEndTime()doublegetFixedPartStartTime()StringgetName()Get the name of the curve.double[]getParameter()Get the current parameter associated with the state of the objects.LocalDategetReferenceDate()Return the reference date of this curve, i.e.doublegetValue(double time)Returns the value for the time using the interpolation method associated with this curve.doublegetValue(AnalyticModel model, double time)Returns the value for the time using the interpolation method associated with this curve within a given context, i.e., a model.voidsetParameter(double[] parameter)Set the current parameter and change the state of the objects.StringtoString()-
Methods inherited from class net.finmath.marketdata.model.curves.AbstractCurve
getValues
-
-
-
-
Method Detail
-
getParameter
public double[] getParameter()
Description copied from interface:ParameterObjectGet the current parameter associated with the state of the objects.- Specified by:
getParameterin interfaceParameterObject- Returns:
- The parameter.
-
setParameter
public void setParameter(double[] parameter)
Description copied from interface:ParameterObjectSet the current parameter and change the state of the objects.- Specified by:
setParameterin interfaceParameterObject- Parameters:
parameter- The parameter associated with the new state of the objects.
-
getName
public String getName()
Description copied from interface:CurveGet the name of the curve.- Specified by:
getNamein interfaceCurve- Overrides:
getNamein classAbstractCurve- Returns:
- The name of this curve
-
getReferenceDate
public LocalDate getReferenceDate()
Description copied from interface:CurveReturn the reference date of this curve, i.e. the date associated with t=0. May be null in case the curve is not associated with a fixed date (e.g. a time homogenous model).- Specified by:
getReferenceDatein interfaceCurve- Overrides:
getReferenceDatein classAbstractCurve- Returns:
- The date identified as t=0.
-
getBaseCurve
public Curve getBaseCurve()
- Returns:
- the baseCurve
-
getFixedPartCurve
public Curve getFixedPartCurve()
- Returns:
- the fixedPartCurve
-
getFixedPartStartTime
public double getFixedPartStartTime()
- Returns:
- the fixedPartStartTime
-
getFixedPartEndTime
public double getFixedPartEndTime()
- Returns:
- the fixedPartEndTime
-
getValue
public double getValue(double time)
Description copied from interface:CurveReturns the value for the time using the interpolation method associated with this curve.- Specified by:
getValuein interfaceCurve- Overrides:
getValuein classAbstractCurve- Parameters:
time- Time for which the value should be returned.- Returns:
- The value at the give time.
-
getValue
public double getValue(AnalyticModel model, double time)
Description copied from interface:CurveReturns the value for the time using the interpolation method associated with this curve within a given context, i.e., a model. The model (context) is needed only if the curve relies on another curve. Examples are a forward curve which relies on a discount curve or a discount curve which is defined via a spread over another curve.
-
getCloneForParameter
public Curve getCloneForParameter(double[] value) throws CloneNotSupportedException
Description copied from interface:ParameterObjectCreate a clone with a modified parameter.- Specified by:
getCloneForParameterin interfaceCurve- Specified by:
getCloneForParameterin interfaceParameterObject- Overrides:
getCloneForParameterin classAbstractCurve- Parameters:
value- The new parameter.- Returns:
- A clone with an otherwise modified parameter.
- Throws:
CloneNotSupportedException- Thrown, when the curve could not be cloned.
-
clone
public PiecewiseCurve clone() throws CloneNotSupportedException
Description copied from interface:CurveCreate a deep copied clone.- Specified by:
clonein interfaceCurve- Overrides:
clonein classAbstractCurve- Returns:
- A clone (deep copied).
- Throws:
CloneNotSupportedException- Thrown, when the curve could not be cloned.
-
getCloneBuilder
public PiecewiseCurve.Builder getCloneBuilder() throws CloneNotSupportedException
Description copied from interface:CurveReturns a curve builder bases on a clone of this curve. Using that curve builder you may create a new curve from this curve by adding points or changing properties. Note: The clone has the same name than this one.- Specified by:
getCloneBuilderin interfaceCurve- Returns:
- An object implementing the CurveBuilderInterface where the underlying curve is a clone of this curve.
- Throws:
CloneNotSupportedException- Thrown, when this curve could not be cloned.
-
toString
public String toString()
- Overrides:
toStringin classAbstractCurve
-
-