net.finmath.marketdata.model.curves
Class PiecewiseCurve
- java.lang.Object
-
- net.finmath.marketdata.model.curves.AbstractCurve
-
- net.finmath.marketdata.model.curves.PiecewiseCurve
-
- All Implemented Interfaces:
- java.lang.Cloneable, ParameterObjectInterface, CurveInterface
- Direct Known Subclasses:
- ForwardCurveWithFixings
public class PiecewiseCurve extends AbstractCurve implements CurveInterface
A piecewise curve. The curve consists of a base curve and a second curve. If thetimeparameter of thegetValue(AnalyticModelInterface, double)method falls inside a pre-defined open interval, it is delegated to the second curve, otherwise it is delegated to the base curve.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classPiecewiseCurve.CurveBuilderA builder (following the builder pattern) for PiecewiseCurve objects.
-
Constructor Summary
Constructors Constructor and Description PiecewiseCurve(CurveInterface curveInterface, CurveInterface fixedPartCurve, double fixedPartStartTime, double fixedPartEndTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PiecewiseCurveclone()Create a deep copied clone.CurveInterfacegetBaseCurve()CurveBuilderInterfacegetCloneBuilder()Returns a curve builder bases on a clone of this curve.CurveInterfacegetCloneForParameter(double[] value)Create a clone with a modified parameter.CurveInterfacegetFixedPartCurve()doublegetFixedPartEndTime()doublegetFixedPartStartTime()java.lang.StringgetName()Get the name of the curve.double[]getParameter()Get the current parameter associated with the state of the objects.java.util.CalendargetReferenceDate()Return the reference date of this curve, i.e.doublegetValue(AnalyticModelInterface 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.doublegetValue(double time)Returns the value for the time using the interpolation method associated with this curve.voidsetParameter(double[] parameter)Set the current parameter and change the state of the objects.java.lang.StringtoString()-
Methods inherited from class net.finmath.marketdata.model.curves.AbstractCurve
getValues
-
-
-
-
Constructor Detail
-
PiecewiseCurve
public PiecewiseCurve(CurveInterface curveInterface, CurveInterface fixedPartCurve, double fixedPartStartTime, double fixedPartEndTime)
-
-
Method Detail
-
getParameter
public double[] getParameter()
Description copied from interface:ParameterObjectInterfaceGet the current parameter associated with the state of the objects.- Specified by:
getParameterin interfaceParameterObjectInterface- Returns:
- The parameter.
-
setParameter
public void setParameter(double[] parameter)
Description copied from interface:ParameterObjectInterfaceSet the current parameter and change the state of the objects.- Specified by:
setParameterin interfaceParameterObjectInterface- Parameters:
parameter- The parameter associated with the new state of the objects.
-
getName
public java.lang.String getName()
Description copied from interface:CurveInterfaceGet the name of the curve.- Specified by:
getNamein interfaceCurveInterface- Overrides:
getNamein classAbstractCurve- Returns:
- The name of this curve
-
getReferenceDate
public java.util.Calendar getReferenceDate()
Description copied from interface:CurveInterfaceReturn the reference date of this curve, i.e. the date associated with t=0.- Specified by:
getReferenceDatein interfaceCurveInterface- Overrides:
getReferenceDatein classAbstractCurve- Returns:
- The date identified as t=0.
-
getBaseCurve
public CurveInterface getBaseCurve()
- Returns:
- the baseCurve
-
getFixedPartCurve
public CurveInterface 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:CurveInterfaceReturns the value for the time using the interpolation method associated with this curve.- Specified by:
getValuein interfaceCurveInterface- Overrides:
getValuein classAbstractCurve- Parameters:
time- Time for which the value should be returned.- Returns:
- The value at the give time.
-
getValue
public double getValue(AnalyticModelInterface model, double time)
Description copied from interface:CurveInterfaceReturns 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.- Specified by:
getValuein interfaceCurveInterface- Parameters:
model- An analytic model providing a context.time- Time for which the value should be returned.- Returns:
- The value at the give time.
-
getCloneForParameter
public CurveInterface getCloneForParameter(double[] value) throws java.lang.CloneNotSupportedException
Description copied from interface:ParameterObjectInterfaceCreate a clone with a modified parameter.- Specified by:
getCloneForParameterin interfaceParameterObjectInterface- Specified by:
getCloneForParameterin interfaceCurveInterface- Overrides:
getCloneForParameterin classAbstractCurve- Parameters:
value- The new parameter.- Returns:
- A clone with an otherwise modified parameter.
- Throws:
java.lang.CloneNotSupportedException- Thrown, when the curve could not be cloned.
-
clone
public PiecewiseCurve clone() throws java.lang.CloneNotSupportedException
Description copied from interface:CurveInterfaceCreate a deep copied clone.- Specified by:
clonein interfaceCurveInterface- Overrides:
clonein classAbstractCurve- Returns:
- A clone (deep copied).
- Throws:
java.lang.CloneNotSupportedException- Thrown, when the curve could not be cloned.
-
getCloneBuilder
public CurveBuilderInterface getCloneBuilder() throws java.lang.CloneNotSupportedException
Description copied from interface:CurveInterfaceReturns 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 interfaceCurveInterface- Returns:
- An object implementing the CurveBuilderInterface where the underlying curve is a clone of this curve.
- Throws:
java.lang.CloneNotSupportedException- Thrown, when this curve could not be cloned.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractCurve
-
-
DataMelt 3.0 © DataMelt by jWork.ORG