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

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

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

  public SobolRsg(long dimensionality, int seed, SobolRsg.DirectionIntegers directionIntegers) {
    this(QuantLibJNI.new_SobolRsg__SWIG_0(dimensionality, seed, directionIntegers.swigValue()), true);
  }

  public SobolRsg(long dimensionality, int seed) {
    this(QuantLibJNI.new_SobolRsg__SWIG_1(dimensionality, seed), true);
  }

  public SobolRsg(long dimensionality) {
    this(QuantLibJNI.new_SobolRsg__SWIG_2(dimensionality), true);
  }

  public SampleRealVector nextSequence() {
    return new SampleRealVector(QuantLibJNI.SobolRsg_nextSequence(swigCPtr, this), false);
  }

  public SampleRealVector lastSequence() {
    return new SampleRealVector(QuantLibJNI.SobolRsg_lastSequence(swigCPtr, this), false);
  }

  public long dimension() {
    return QuantLibJNI.SobolRsg_dimension(swigCPtr, this);
  }

  public void skipTo(long n) {
    QuantLibJNI.SobolRsg_skipTo(swigCPtr, this, n);
  }

  public UnsignedIntVector nextInt32Sequence() {
    return new UnsignedIntVector(QuantLibJNI.SobolRsg_nextInt32Sequence(swigCPtr, this), true);
  }

  public final static class DirectionIntegers {
    public final static SobolRsg.DirectionIntegers Unit = new SobolRsg.DirectionIntegers("Unit");
    public final static SobolRsg.DirectionIntegers Jaeckel = new SobolRsg.DirectionIntegers("Jaeckel");
    public final static SobolRsg.DirectionIntegers SobolLevitan = new SobolRsg.DirectionIntegers("SobolLevitan");
    public final static SobolRsg.DirectionIntegers SobolLevitanLemieux = new SobolRsg.DirectionIntegers("SobolLevitanLemieux");
    public final static SobolRsg.DirectionIntegers JoeKuoD5 = new SobolRsg.DirectionIntegers("JoeKuoD5");
    public final static SobolRsg.DirectionIntegers JoeKuoD6 = new SobolRsg.DirectionIntegers("JoeKuoD6");
    public final static SobolRsg.DirectionIntegers JoeKuoD7 = new SobolRsg.DirectionIntegers("JoeKuoD7");
    public final static SobolRsg.DirectionIntegers Kuo = new SobolRsg.DirectionIntegers("Kuo");
    public final static SobolRsg.DirectionIntegers Kuo2 = new SobolRsg.DirectionIntegers("Kuo2");
    public final static SobolRsg.DirectionIntegers Kuo3 = new SobolRsg.DirectionIntegers("Kuo3");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

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

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

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

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

    private static DirectionIntegers[] swigValues = { Unit, Jaeckel, SobolLevitan, SobolLevitanLemieux, JoeKuoD5, JoeKuoD6, JoeKuoD7, Kuo, Kuo2, Kuo3 };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
