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 StochasticProcessVector extends java.util.AbstractList<StochasticProcess> implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable, java.util.RandomAccess { 012 private transient long swigCPtr; 013 protected transient boolean swigCMemOwn; 014 015 protected StochasticProcessVector(long cPtr, boolean cMemoryOwn) { 016 swigCMemOwn = cMemoryOwn; 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(StochasticProcessVector obj) { 021 return (obj == null) ? 0 : obj.swigCPtr; 022 } 023 024 protected static long swigRelease(StochasticProcessVector 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_StochasticProcessVector(swigCPtr); 046 } 047 swigCPtr = 0; 048 } 049 } 050 051 public StochasticProcessVector(StochasticProcess[] initialElements) { 052 this(); 053 reserve(initialElements.length); 054 055 for (StochasticProcess element : initialElements) { 056 add(element); 057 } 058 } 059 060 public StochasticProcessVector(Iterable<StochasticProcess> initialElements) { 061 this(); 062 for (StochasticProcess element : initialElements) { 063 add(element); 064 } 065 } 066 067 public StochasticProcess get(int index) { 068 return doGet(index); 069 } 070 071 public StochasticProcess set(int index, StochasticProcess e) { 072 return doSet(index, e); 073 } 074 075 public boolean add(StochasticProcess e) { 076 modCount++; 077 doAdd(e); 078 return true; 079 } 080 081 public void add(int index, StochasticProcess e) { 082 modCount++; 083 doAdd(index, e); 084 } 085 086 public StochasticProcess remove(int index) { 087 modCount++; 088 return doRemove(index); 089 } 090 091 protected void removeRange(int fromIndex, int toIndex) { 092 modCount++; 093 doRemoveRange(fromIndex, toIndex); 094 } 095 096 public int size() { 097 return doSize(); 098 } 099 100 public StochasticProcessVector() { 101 this(QuantLibJNI.new_StochasticProcessVector__SWIG_0(), true); 102 } 103 104 public StochasticProcessVector(StochasticProcessVector other) { 105 this(QuantLibJNI.new_StochasticProcessVector__SWIG_1(StochasticProcessVector.getCPtr(other), other), true); 106 } 107 108 public long capacity() { 109 return QuantLibJNI.StochasticProcessVector_capacity(swigCPtr, this); 110 } 111 112 public void reserve(long n) { 113 QuantLibJNI.StochasticProcessVector_reserve(swigCPtr, this, n); 114 } 115 116 public boolean isEmpty() { 117 return QuantLibJNI.StochasticProcessVector_isEmpty(swigCPtr, this); 118 } 119 120 public void clear() { 121 QuantLibJNI.StochasticProcessVector_clear(swigCPtr, this); 122 } 123 124 public StochasticProcessVector(int count, StochasticProcess value) { 125 this(QuantLibJNI.new_StochasticProcessVector__SWIG_2(count, StochasticProcess.getCPtr(value), value), true); 126 } 127 128 private int doSize() { 129 return QuantLibJNI.StochasticProcessVector_doSize(swigCPtr, this); 130 } 131 132 private void doAdd(StochasticProcess x) { 133 QuantLibJNI.StochasticProcessVector_doAdd__SWIG_0(swigCPtr, this, StochasticProcess.getCPtr(x), x); 134 } 135 136 private void doAdd(int index, StochasticProcess x) { 137 QuantLibJNI.StochasticProcessVector_doAdd__SWIG_1(swigCPtr, this, index, StochasticProcess.getCPtr(x), x); 138 } 139 140 private StochasticProcess doRemove(int index) { 141 long cPtr = QuantLibJNI.StochasticProcessVector_doRemove(swigCPtr, this, index); 142 return (cPtr == 0) ? null : new StochasticProcess(cPtr, true); 143 } 144 145 private StochasticProcess doGet(int index) { 146 long cPtr = QuantLibJNI.StochasticProcessVector_doGet(swigCPtr, this, index); 147 return (cPtr == 0) ? null : new StochasticProcess(cPtr, true); 148 } 149 150 private StochasticProcess doSet(int index, StochasticProcess val) { 151 long cPtr = QuantLibJNI.StochasticProcessVector_doSet(swigCPtr, this, index, StochasticProcess.getCPtr(val), val); 152 return (cPtr == 0) ? null : new StochasticProcess(cPtr, true); 153 } 154 155 private void doRemoveRange(int fromIndex, int toIndex) { 156 QuantLibJNI.StochasticProcessVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex); 157 } 158 159}