/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.12
 *
 * 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 CapFloor extends Instrument {
  private transient long swigCPtr;

  protected CapFloor(long cPtr, boolean cMemoryOwn) {
    super(QuantLibJNI.CapFloor_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

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

  protected void finalize() {
    delete();
  }

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

  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol, VolatilityType type, double displacement) {
    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_0(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations, minVol, maxVol, type.swigValue(), displacement);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol, VolatilityType type) {
    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_1(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations, minVol, maxVol, type.swigValue());
  }

  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol) {
    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_2(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations, minVol, maxVol);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations, double minVol) {
    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_3(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations, minVol);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy, long maxEvaluations) {
    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_4(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy, maxEvaluations);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess, double accuracy) {
    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_5(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess, accuracy);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle disc, double guess) {
    return QuantLibJNI.CapFloor_impliedVolatility__SWIG_6(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(disc), disc, guess);
  }

  public Leg floatingLeg() {
    return new Leg(QuantLibJNI.CapFloor_floatingLeg(swigCPtr, this), false);
  }

  public DoubleVector capRates() {
    return new DoubleVector(QuantLibJNI.CapFloor_capRates(swigCPtr, this), false);
  }

  public DoubleVector floorRates() {
    return new DoubleVector(QuantLibJNI.CapFloor_floorRates(swigCPtr, this), false);
  }

  public Date startDate() {
    return new Date(QuantLibJNI.CapFloor_startDate(swigCPtr, this), true);
  }

  public Date maturityDate() {
    return new Date(QuantLibJNI.CapFloor_maturityDate(swigCPtr, this), true);
  }

  public double atmRate(YieldTermStructure discountCurve) {
    return QuantLibJNI.CapFloor_atmRate(swigCPtr, this, YieldTermStructure.getCPtr(discountCurve), discountCurve);
  }

  public CapFloor() {
    this(QuantLibJNI.new_CapFloor(), true);
  }

}
