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

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

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

  public long size() {
    return QuantLibJNI.StochasticProcess_size(swigCPtr, this);
  }

  public long factors() {
    return QuantLibJNI.StochasticProcess_factors(swigCPtr, this);
  }

  public Array initialValues() {
    return new Array(QuantLibJNI.StochasticProcess_initialValues(swigCPtr, this), true);
  }

  public Array drift(double t, Array x) {
    return new Array(QuantLibJNI.StochasticProcess_drift(swigCPtr, this, t, Array.getCPtr(x), x), true);
  }

  public Matrix diffusion(double t, Array x) {
    return new Matrix(QuantLibJNI.StochasticProcess_diffusion(swigCPtr, this, t, Array.getCPtr(x), x), true);
  }

  public Array expectation(double t0, Array x0, double dt) {
    return new Array(QuantLibJNI.StochasticProcess_expectation(swigCPtr, this, t0, Array.getCPtr(x0), x0, dt), true);
  }

  public Matrix stdDeviation(double t0, Array x0, double dt) {
    return new Matrix(QuantLibJNI.StochasticProcess_stdDeviation(swigCPtr, this, t0, Array.getCPtr(x0), x0, dt), true);
  }

  public Matrix covariance(double t0, Array x0, double dt) {
    return new Matrix(QuantLibJNI.StochasticProcess_covariance(swigCPtr, this, t0, Array.getCPtr(x0), x0, dt), true);
  }

  public Array evolve(double t0, Array x0, double dt, Array dw) {
    return new Array(QuantLibJNI.StochasticProcess_evolve(swigCPtr, this, t0, Array.getCPtr(x0), x0, dt, Array.getCPtr(dw), dw), true);
  }

}
