001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (https://www.swig.org). 003 * Version 4.1.1 004 * 005 * Do not make changes to this file unless you know what you are doing - modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.quantlib; 010 011public class SobolRsg implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 protected transient boolean swigCMemOwn; 014 015 protected SobolRsg(long cPtr, boolean cMemoryOwn) { 016 swigCMemOwn = cMemoryOwn; 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(SobolRsg obj) { 021 return (obj == null) ? 0 : obj.swigCPtr; 022 } 023 024 protected static long swigRelease(SobolRsg obj) { 025 long ptr = 0; 026 if (obj != null) { 027 if (!obj.swigCMemOwn) 028 throw new RuntimeException("Cannot release ownership as memory is not owned"); 029 ptr = obj.swigCPtr; 030 obj.swigCMemOwn = false; 031 obj.delete(); 032 } 033 return ptr; 034 } 035 036 @SuppressWarnings("deprecation") 037 protected void finalize() { 038 delete(); 039 } 040 041 public synchronized void delete() { 042 if (swigCPtr != 0) { 043 if (swigCMemOwn) { 044 swigCMemOwn = false; 045 QuantLibJNI.delete_SobolRsg(swigCPtr); 046 } 047 swigCPtr = 0; 048 } 049 } 050 051 public SobolRsg(long dimensionality, int seed, SobolRsg.DirectionIntegers directionIntegers) { 052 this(QuantLibJNI.new_SobolRsg__SWIG_0(dimensionality, seed, directionIntegers.swigValue()), true); 053 } 054 055 public SobolRsg(long dimensionality, int seed) { 056 this(QuantLibJNI.new_SobolRsg__SWIG_1(dimensionality, seed), true); 057 } 058 059 public SobolRsg(long dimensionality) { 060 this(QuantLibJNI.new_SobolRsg__SWIG_2(dimensionality), true); 061 } 062 063 public SampleRealVector nextSequence() { 064 return new SampleRealVector(QuantLibJNI.SobolRsg_nextSequence(swigCPtr, this), false); 065 } 066 067 public SampleRealVector lastSequence() { 068 return new SampleRealVector(QuantLibJNI.SobolRsg_lastSequence(swigCPtr, this), false); 069 } 070 071 public long dimension() { 072 return QuantLibJNI.SobolRsg_dimension(swigCPtr, this); 073 } 074 075 public void skipTo(long n) { 076 QuantLibJNI.SobolRsg_skipTo(swigCPtr, this, n); 077 } 078 079 public UnsignedIntVector nextInt32Sequence() { 080 return new UnsignedIntVector(QuantLibJNI.SobolRsg_nextInt32Sequence(swigCPtr, this), true); 081 } 082 083 public final static class DirectionIntegers { 084 public final static SobolRsg.DirectionIntegers Unit = new SobolRsg.DirectionIntegers("Unit"); 085 public final static SobolRsg.DirectionIntegers Jaeckel = new SobolRsg.DirectionIntegers("Jaeckel"); 086 public final static SobolRsg.DirectionIntegers SobolLevitan = new SobolRsg.DirectionIntegers("SobolLevitan"); 087 public final static SobolRsg.DirectionIntegers SobolLevitanLemieux = new SobolRsg.DirectionIntegers("SobolLevitanLemieux"); 088 public final static SobolRsg.DirectionIntegers JoeKuoD5 = new SobolRsg.DirectionIntegers("JoeKuoD5"); 089 public final static SobolRsg.DirectionIntegers JoeKuoD6 = new SobolRsg.DirectionIntegers("JoeKuoD6"); 090 public final static SobolRsg.DirectionIntegers JoeKuoD7 = new SobolRsg.DirectionIntegers("JoeKuoD7"); 091 public final static SobolRsg.DirectionIntegers Kuo = new SobolRsg.DirectionIntegers("Kuo"); 092 public final static SobolRsg.DirectionIntegers Kuo2 = new SobolRsg.DirectionIntegers("Kuo2"); 093 public final static SobolRsg.DirectionIntegers Kuo3 = new SobolRsg.DirectionIntegers("Kuo3"); 094 095 public final int swigValue() { 096 return swigValue; 097 } 098 099 public String toString() { 100 return swigName; 101 } 102 103 public static DirectionIntegers swigToEnum(int swigValue) { 104 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 105 return swigValues[swigValue]; 106 for (int i = 0; i < swigValues.length; i++) 107 if (swigValues[i].swigValue == swigValue) 108 return swigValues[i]; 109 throw new IllegalArgumentException("No enum " + DirectionIntegers.class + " with value " + swigValue); 110 } 111 112 private DirectionIntegers(String swigName) { 113 this.swigName = swigName; 114 this.swigValue = swigNext++; 115 } 116 117 private DirectionIntegers(String swigName, int swigValue) { 118 this.swigName = swigName; 119 this.swigValue = swigValue; 120 swigNext = swigValue+1; 121 } 122 123 private DirectionIntegers(String swigName, DirectionIntegers swigEnum) { 124 this.swigName = swigName; 125 this.swigValue = swigEnum.swigValue; 126 swigNext = this.swigValue+1; 127 } 128 129 private static DirectionIntegers[] swigValues = { Unit, Jaeckel, SobolLevitan, SobolLevitanLemieux, JoeKuoD5, JoeKuoD6, JoeKuoD7, Kuo, Kuo2, Kuo3 }; 130 private static int swigNext = 0; 131 private final int swigValue; 132 private final String swigName; 133 } 134 135}