/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (https://www.swig.org).
 * Version 4.1.1
 *
 * 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 FdmMesher {
  private transient long swigCPtr;
  private transient boolean swigCMemOwn;

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

  protected static long getCPtr(FdmMesher 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_FdmMesher(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public double dplus(FdmLinearOpIterator iter, long direction) {
    return QuantLibJNI.FdmMesher_dplus(swigCPtr, this, FdmLinearOpIterator.getCPtr(iter), iter, direction);
  }

  public double dminus(FdmLinearOpIterator iter, long direction) {
    return QuantLibJNI.FdmMesher_dminus(swigCPtr, this, FdmLinearOpIterator.getCPtr(iter), iter, direction);
  }

  public double location(FdmLinearOpIterator iter, long direction) {
    return QuantLibJNI.FdmMesher_location(swigCPtr, this, FdmLinearOpIterator.getCPtr(iter), iter, direction);
  }

  public Array locations(long direction) {
    return new Array(QuantLibJNI.FdmMesher_locations(swigCPtr, this, direction), true);
  }

  public FdmLinearOpLayout layout() {
    long cPtr = QuantLibJNI.FdmMesher_layout(swigCPtr, this);
    return (cPtr == 0) ? null : new FdmLinearOpLayout(cPtr, true);
  }

}
