/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.quantlib;

public class NonstandardSwaption extends Instrument {
  private transient long swigCPtr;
  private transient boolean swigCMemOwnDerived;

  protected NonstandardSwaption(long cPtr, boolean cMemoryOwn) {
    super(QuantLibJNI.NonstandardSwaption_SWIGSmartPtrUpcast(cPtr), true);
    swigCMemOwnDerived = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(NonstandardSwaption obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void swigSetCMemOwn(boolean own) {
    swigCMemOwnDerived = own;
    super.swigSetCMemOwn(own);
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwnDerived) {
        swigCMemOwnDerived = false;
        QuantLibJNI.delete_NonstandardSwaption(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public NonstandardSwaption(NonstandardSwap swap, Exercise exercise, Settlement.Type type, Settlement.Method settlementMethod) {
    this(QuantLibJNI.new_NonstandardSwaption__SWIG_0(NonstandardSwap.getCPtr(swap), swap, Exercise.getCPtr(exercise), exercise, type.swigValue(), settlementMethod.swigValue()), true);
  }

  public NonstandardSwaption(NonstandardSwap swap, Exercise exercise, Settlement.Type type) {
    this(QuantLibJNI.new_NonstandardSwaption__SWIG_1(NonstandardSwap.getCPtr(swap), swap, Exercise.getCPtr(exercise), exercise, type.swigValue()), true);
  }

  public NonstandardSwaption(NonstandardSwap swap, Exercise exercise) {
    this(QuantLibJNI.new_NonstandardSwaption__SWIG_2(NonstandardSwap.getCPtr(swap), swap, Exercise.getCPtr(exercise), exercise), true);
  }

  public NonstandardSwap underlyingSwap() {
    long cPtr = QuantLibJNI.NonstandardSwaption_underlyingSwap(swigCPtr, this);
    return (cPtr == 0) ? null : new NonstandardSwap(cPtr, true);
  }

  public BlackCalibrationHelperVector calibrationBasket(SwapIndex swapIndex, SwaptionVolatilityStructure swaptionVolatility, String typeStr) {
    return new BlackCalibrationHelperVector(QuantLibJNI.NonstandardSwaption_calibrationBasket(swigCPtr, this, SwapIndex.getCPtr(swapIndex), swapIndex, SwaptionVolatilityStructure.getCPtr(swaptionVolatility), swaptionVolatility, typeStr), true);
  }

  public DoubleVector probabilities() {
    return new DoubleVector(QuantLibJNI.NonstandardSwaption_probabilities(swigCPtr, this), true);
  }

}
