001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (https://www.swig.org).
003 * Version 4.1.1
004 *
005 * Do not make changes to this file unless you know what you are doing - modify
006 * the SWIG interface file instead.
007 * ----------------------------------------------------------------------------- */
008
009package org.quantlib;
010
011public class CapFloor extends Instrument implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013  private transient boolean swigCMemOwnDerived;
014
015  protected CapFloor(long cPtr, boolean cMemoryOwn) {
016    super(QuantLibJNI.CapFloor_SWIGSmartPtrUpcast(cPtr), true);
017    swigCMemOwnDerived = cMemoryOwn;
018    swigCPtr = cPtr;
019  }
020
021  protected static long getCPtr(CapFloor obj) {
022    return (obj == null) ? 0 : obj.swigCPtr;
023  }
024
025  protected void swigSetCMemOwn(boolean own) {
026    swigCMemOwnDerived = own;
027    super.swigSetCMemOwn(own);
028  }
029
030  @SuppressWarnings("deprecation")
031  protected void finalize() {
032    delete();
033  }
034
035  public synchronized void delete() {
036    if (swigCPtr != 0) {
037      if (swigCMemOwnDerived) {
038        swigCMemOwnDerived = false;
039        QuantLibJNI.delete_CapFloor(swigCPtr);
040      }
041      swigCPtr = 0;
042    }
043    super.delete();
044  }
045
046  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol, VolatilityType type, double displacement) {
047    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_0(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations, minVol, maxVol, type.swigValue(), displacement);
048  }
049
050  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol, VolatilityType type) {
051    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_1(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations, minVol, maxVol, type.swigValue());
052  }
053
054  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol) {
055    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_2(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations, minVol, maxVol);
056  }
057
058  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations, double minVol) {
059    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_3(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations, minVol);
060  }
061
062  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations) {
063    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_4(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations);
064  }
065
066  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy) {
067    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_5(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy);
068  }
069
070  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess) {
071    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_6(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess);
072  }
073
074  public Leg floatingLeg() {
075    return new Leg(QuantLibJNI.CapFloor_floatingLeg(swigCPtr, this), false);
076  }
077
078  public DoubleVector capRates() {
079    return new DoubleVector(QuantLibJNI.CapFloor_capRates(swigCPtr, this), false);
080  }
081
082  public DoubleVector floorRates() {
083    return new DoubleVector(QuantLibJNI.CapFloor_floorRates(swigCPtr, this), false);
084  }
085
086  public Date startDate() {
087    return new Date(QuantLibJNI.CapFloor_startDate(swigCPtr, this), true);
088  }
089
090  public Date maturityDate() {
091    return new Date(QuantLibJNI.CapFloor_maturityDate(swigCPtr, this), true);
092  }
093
094  public CapFloor.Type type() {
095    return CapFloor.Type.swigToEnum(QuantLibJNI.CapFloor_type(swigCPtr, this));
096  }
097
098  public double atmRate(YieldTermStructure discountCurve) {
099    return QuantLibJNI.CapFloor_atmRate(swigCPtr, this, YieldTermStructure.getCPtr(discountCurve), discountCurve);
100  }
101
102  public double vega() {
103    return QuantLibJNI.CapFloor_vega(swigCPtr, this);
104  }
105
106  public DoubleVector optionletsPrice() {
107    return new DoubleVector(QuantLibJNI.CapFloor_optionletsPrice(swigCPtr, this), true);
108  }
109
110  public DoubleVector optionletsVega() {
111    return new DoubleVector(QuantLibJNI.CapFloor_optionletsVega(swigCPtr, this), true);
112  }
113
114  public DoubleVector optionletsDelta() {
115    return new DoubleVector(QuantLibJNI.CapFloor_optionletsDelta(swigCPtr, this), true);
116  }
117
118  public DoubleVector optionletsDiscountFactor() {
119    return new DoubleVector(QuantLibJNI.CapFloor_optionletsDiscountFactor(swigCPtr, this), true);
120  }
121
122  public DoubleVector optionletsAtmForward() {
123    return new DoubleVector(QuantLibJNI.CapFloor_optionletsAtmForward(swigCPtr, this), true);
124  }
125
126  public DoubleVector optionletsStdDev() {
127    return new DoubleVector(QuantLibJNI.CapFloor_optionletsStdDev(swigCPtr, this), true);
128  }
129
130  public final static class Type {
131    public final static CapFloor.Type Cap = new CapFloor.Type("Cap");
132    public final static CapFloor.Type Floor = new CapFloor.Type("Floor");
133    public final static CapFloor.Type Collar = new CapFloor.Type("Collar");
134
135    public final int swigValue() {
136      return swigValue;
137    }
138
139    public String toString() {
140      return swigName;
141    }
142
143    public static Type swigToEnum(int swigValue) {
144      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
145        return swigValues[swigValue];
146      for (int i = 0; i < swigValues.length; i++)
147        if (swigValues[i].swigValue == swigValue)
148          return swigValues[i];
149      throw new IllegalArgumentException("No enum " + Type.class + " with value " + swigValue);
150    }
151
152    private Type(String swigName) {
153      this.swigName = swigName;
154      this.swigValue = swigNext++;
155    }
156
157    private Type(String swigName, int swigValue) {
158      this.swigName = swigName;
159      this.swigValue = swigValue;
160      swigNext = swigValue+1;
161    }
162
163    private Type(String swigName, Type swigEnum) {
164      this.swigName = swigName;
165      this.swigValue = swigEnum.swigValue;
166      swigNext = this.swigValue+1;
167    }
168
169    private static Type[] swigValues = { Cap, Floor, Collar };
170    private static int swigNext = 0;
171    private final int swigValue;
172    private final String swigName;
173  }
174
175}