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 Swaption extends Option implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013  private transient boolean swigCMemOwnDerived;
014
015  protected Swaption(long cPtr, boolean cMemoryOwn) {
016    super(QuantLibJNI.Swaption_SWIGSmartPtrUpcast(cPtr), true);
017    swigCMemOwnDerived = cMemoryOwn;
018    swigCPtr = cPtr;
019  }
020
021  protected static long getCPtr(Swaption 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_Swaption(swigCPtr);
040      }
041      swigCPtr = 0;
042    }
043    super.delete();
044  }
045
046  public Swaption(VanillaSwap swap, Exercise exercise, Settlement.Type type, Settlement.Method settlementMethod) {
047    this(QuantLibJNI.new_Swaption__SWIG_0(VanillaSwap.getCPtr(swap), swap, Exercise.getCPtr(exercise), exercise, type.swigValue(), settlementMethod.swigValue()), true);
048  }
049
050  public Swaption(VanillaSwap swap, Exercise exercise, Settlement.Type type) {
051    this(QuantLibJNI.new_Swaption__SWIG_1(VanillaSwap.getCPtr(swap), swap, Exercise.getCPtr(exercise), exercise, type.swigValue()), true);
052  }
053
054  public Swaption(VanillaSwap swap, Exercise exercise) {
055    this(QuantLibJNI.new_Swaption__SWIG_2(VanillaSwap.getCPtr(swap), swap, Exercise.getCPtr(exercise), exercise), true);
056  }
057
058  public Settlement.Type settlementType() {
059    return Settlement.Type.swigToEnum(QuantLibJNI.Swaption_settlementType(swigCPtr, this));
060  }
061
062  public Settlement.Method settlementMethod() {
063    return Settlement.Method.swigToEnum(QuantLibJNI.Swaption_settlementMethod(swigCPtr, this));
064  }
065
066  public Swap.Type type() {
067    return Swap.Type.swigToEnum(QuantLibJNI.Swaption_type(swigCPtr, this));
068  }
069
070  public VanillaSwap underlyingSwap() {
071    long cPtr = QuantLibJNI.Swaption_underlyingSwap(swigCPtr, this);
072    return (cPtr == 0) ? null : new VanillaSwap(cPtr, true);
073  }
074
075  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol, VolatilityType type, double displacement) {
076    return QuantLibJNI.Swaption_impliedVolatility__SWIG_0(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations, minVol, maxVol, type.swigValue(), displacement);
077  }
078
079  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol, VolatilityType type) {
080    return QuantLibJNI.Swaption_impliedVolatility__SWIG_1(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations, minVol, maxVol, type.swigValue());
081  }
082
083  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol) {
084    return QuantLibJNI.Swaption_impliedVolatility__SWIG_2(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations, minVol, maxVol);
085  }
086
087  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations, double minVol) {
088    return QuantLibJNI.Swaption_impliedVolatility__SWIG_3(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations, minVol);
089  }
090
091  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations) {
092    return QuantLibJNI.Swaption_impliedVolatility__SWIG_4(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations);
093  }
094
095  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy) {
096    return QuantLibJNI.Swaption_impliedVolatility__SWIG_5(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy);
097  }
098
099  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess) {
100    return QuantLibJNI.Swaption_impliedVolatility__SWIG_6(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess);
101  }
102
103  public double vega() {
104    return QuantLibJNI.Swaption_vega(swigCPtr, this);
105  }
106
107  public double delta() {
108    return QuantLibJNI.Swaption_delta(swigCPtr, this);
109  }
110
111  public double annuity() {
112    return QuantLibJNI.Swaption_annuity(swigCPtr, this);
113  }
114
115}