/* ----------------------------------------------------------------------------
 * 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 FdmSchemeDesc {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected FdmSchemeDesc(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

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

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

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

  public FdmSchemeDesc(FdmSchemeDesc.FdmSchemeType type, double theta, double mu) {
    this(QuantLibJNI.new_FdmSchemeDesc(type.swigValue(), theta, mu), true);
  }

  public FdmSchemeDesc.FdmSchemeType getType() {
    return FdmSchemeDesc.FdmSchemeType.swigToEnum(QuantLibJNI.FdmSchemeDesc_type_get(swigCPtr, this));
  }

  public double getTheta() {
    return QuantLibJNI.FdmSchemeDesc_theta_get(swigCPtr, this);
  }

  public double getMu() {
    return QuantLibJNI.FdmSchemeDesc_mu_get(swigCPtr, this);
  }

  public static FdmSchemeDesc Douglas() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_Douglas(), true);
  }

  public static FdmSchemeDesc CrankNicolson() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_CrankNicolson(), true);
  }

  public static FdmSchemeDesc ImplicitEuler() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_ImplicitEuler(), true);
  }

  public static FdmSchemeDesc ExplicitEuler() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_ExplicitEuler(), true);
  }

  public static FdmSchemeDesc CraigSneyd() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_CraigSneyd(), true);
  }

  public static FdmSchemeDesc ModifiedCraigSneyd() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_ModifiedCraigSneyd(), true);
  }

  public static FdmSchemeDesc Hundsdorfer() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_Hundsdorfer(), true);
  }

  public static FdmSchemeDesc ModifiedHundsdorfer() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_ModifiedHundsdorfer(), true);
  }

  public static FdmSchemeDesc MethodOfLines(double eps, double relInitStepSize) {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_MethodOfLines__SWIG_0(eps, relInitStepSize), true);
  }

  public static FdmSchemeDesc MethodOfLines(double eps) {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_MethodOfLines__SWIG_1(eps), true);
  }

  public static FdmSchemeDesc MethodOfLines() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_MethodOfLines__SWIG_2(), true);
  }

  public static FdmSchemeDesc TrBDF2() {
    return new FdmSchemeDesc(QuantLibJNI.FdmSchemeDesc_TrBDF2(), true);
  }

  public final static class FdmSchemeType {
    public final static FdmSchemeDesc.FdmSchemeType HundsdorferType = new FdmSchemeDesc.FdmSchemeType("HundsdorferType");
    public final static FdmSchemeDesc.FdmSchemeType DouglasType = new FdmSchemeDesc.FdmSchemeType("DouglasType");
    public final static FdmSchemeDesc.FdmSchemeType CraigSneydType = new FdmSchemeDesc.FdmSchemeType("CraigSneydType");
    public final static FdmSchemeDesc.FdmSchemeType ModifiedCraigSneydType = new FdmSchemeDesc.FdmSchemeType("ModifiedCraigSneydType");
    public final static FdmSchemeDesc.FdmSchemeType ImplicitEulerType = new FdmSchemeDesc.FdmSchemeType("ImplicitEulerType");
    public final static FdmSchemeDesc.FdmSchemeType ExplicitEulerType = new FdmSchemeDesc.FdmSchemeType("ExplicitEulerType");
    public final static FdmSchemeDesc.FdmSchemeType MethodOfLinesType = new FdmSchemeDesc.FdmSchemeType("MethodOfLinesType");
    public final static FdmSchemeDesc.FdmSchemeType TrBDF2Type = new FdmSchemeDesc.FdmSchemeType("TrBDF2Type");
    public final static FdmSchemeDesc.FdmSchemeType CrankNicolsonType = new FdmSchemeDesc.FdmSchemeType("CrankNicolsonType");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static FdmSchemeType 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 " + FdmSchemeType.class + " with value " + swigValue);
    }

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

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

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

    private static FdmSchemeType[] swigValues = { HundsdorferType, DouglasType, CraigSneydType, ModifiedCraigSneydType, ImplicitEulerType, ExplicitEulerType, MethodOfLinesType, TrBDF2Type, CrankNicolsonType };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
