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

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

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

  protected void swigSetCMemOwn(boolean own) {
    swigCMemOwn = own;
  }

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

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

  public FdmBackwardSolver(FdmLinearOpComposite map, FdmBoundaryConditionSet bcSet, FdmStepConditionComposite condition, FdmSchemeDesc schemeDesc) {
    this(QuantLibJNI.new_FdmBackwardSolver(FdmLinearOpComposite.getCPtr(map), map, FdmBoundaryConditionSet.getCPtr(bcSet), bcSet, FdmStepConditionComposite.getCPtr(condition), condition, FdmSchemeDesc.getCPtr(schemeDesc), schemeDesc), true);
  }

  public void rollback(Array a, double from, double to, long steps, long dampingSteps) {
    QuantLibJNI.FdmBackwardSolver_rollback(swigCPtr, this, Array.getCPtr(a), a, from, to, steps, dampingSteps);
  }

}
