/* ----------------------------------------------------------------------------
 * 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 BlackVarianceSurface extends BlackVolTermStructure {
  private transient long swigCPtr;
  private transient boolean swigCMemOwnDerived;

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

  protected static long getCPtr(BlackVarianceSurface 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_BlackVarianceSurface(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public BlackVarianceSurface(Date referenceDate, Calendar cal, DateVector dates, DoubleVector strikes, Matrix blackVols, DayCounter dayCounter, BlackVarianceSurface.Extrapolation lower, BlackVarianceSurface.Extrapolation upper, String interpolator) {
    this(QuantLibJNI.new_BlackVarianceSurface__SWIG_0(Date.getCPtr(referenceDate), referenceDate, Calendar.getCPtr(cal), cal, DateVector.getCPtr(dates), dates, DoubleVector.getCPtr(strikes), strikes, Matrix.getCPtr(blackVols), blackVols, DayCounter.getCPtr(dayCounter), dayCounter, lower.swigValue(), upper.swigValue(), interpolator), true);
  }

  public BlackVarianceSurface(Date referenceDate, Calendar cal, DateVector dates, DoubleVector strikes, Matrix blackVols, DayCounter dayCounter, BlackVarianceSurface.Extrapolation lower, BlackVarianceSurface.Extrapolation upper) {
    this(QuantLibJNI.new_BlackVarianceSurface__SWIG_1(Date.getCPtr(referenceDate), referenceDate, Calendar.getCPtr(cal), cal, DateVector.getCPtr(dates), dates, DoubleVector.getCPtr(strikes), strikes, Matrix.getCPtr(blackVols), blackVols, DayCounter.getCPtr(dayCounter), dayCounter, lower.swigValue(), upper.swigValue()), true);
  }

  public BlackVarianceSurface(Date referenceDate, Calendar cal, DateVector dates, DoubleVector strikes, Matrix blackVols, DayCounter dayCounter, BlackVarianceSurface.Extrapolation lower) {
    this(QuantLibJNI.new_BlackVarianceSurface__SWIG_2(Date.getCPtr(referenceDate), referenceDate, Calendar.getCPtr(cal), cal, DateVector.getCPtr(dates), dates, DoubleVector.getCPtr(strikes), strikes, Matrix.getCPtr(blackVols), blackVols, DayCounter.getCPtr(dayCounter), dayCounter, lower.swigValue()), true);
  }

  public BlackVarianceSurface(Date referenceDate, Calendar cal, DateVector dates, DoubleVector strikes, Matrix blackVols, DayCounter dayCounter) {
    this(QuantLibJNI.new_BlackVarianceSurface__SWIG_3(Date.getCPtr(referenceDate), referenceDate, Calendar.getCPtr(cal), cal, DateVector.getCPtr(dates), dates, DoubleVector.getCPtr(strikes), strikes, Matrix.getCPtr(blackVols), blackVols, DayCounter.getCPtr(dayCounter), dayCounter), true);
  }

  public void setInterpolation(String interpolator) {
    QuantLibJNI.BlackVarianceSurface_setInterpolation__SWIG_0(swigCPtr, this, interpolator);
  }

  public void setInterpolation() {
    QuantLibJNI.BlackVarianceSurface_setInterpolation__SWIG_1(swigCPtr, this);
  }

  public final static class Extrapolation {
    public final static BlackVarianceSurface.Extrapolation ConstantExtrapolation = new BlackVarianceSurface.Extrapolation("ConstantExtrapolation");
    public final static BlackVarianceSurface.Extrapolation InterpolatorDefaultExtrapolation = new BlackVarianceSurface.Extrapolation("InterpolatorDefaultExtrapolation");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static Extrapolation swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + Extrapolation.class + " with value " + swigValue);
    }

    private Extrapolation(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private Extrapolation(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private Extrapolation(String swigName, Extrapolation swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static Extrapolation[] swigValues = { ConstantExtrapolation, InterpolatorDefaultExtrapolation };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
