Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
DoubleVector.cs
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// <auto-generated />
3//
4// This file was automatically generated by SWIG (https://www.swig.org).
5// Version 4.2.1
6//
7// Do not make changes to this file unless you know what you are doing - modify
8// the SWIG interface file instead.
9//------------------------------------------------------------------------------
10
12
13public class DoubleVector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<double>
14 {
15 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
16 protected bool swigCMemOwn;
17
18 internal DoubleVector(global::System.IntPtr cPtr, bool cMemoryOwn) {
19 swigCMemOwn = cMemoryOwn;
20 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
21 }
22
23 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(DoubleVector obj) {
24 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
25 }
26
27 internal static global::System.Runtime.InteropServices.HandleRef swigRelease(DoubleVector obj) {
28 if (obj != null) {
29 if (!obj.swigCMemOwn)
30 throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
31 global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
32 obj.swigCMemOwn = false;
33 obj.Dispose();
34 return ptr;
35 } else {
36 return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
37 }
38 }
39
40 ~DoubleVector() {
41 Dispose(false);
42 }
43
44 public void Dispose() {
45 Dispose(true);
46 global::System.GC.SuppressFinalize(this);
47 }
48
49 protected virtual void Dispose(bool disposing) {
50 lock(this) {
51 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
52 if (swigCMemOwn) {
53 swigCMemOwn = false;
55 }
56 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
57 }
58 }
59 }
60
61 public DoubleVector(global::System.Collections.IEnumerable c) : this() {
62 if (c == null)
63 throw new global::System.ArgumentNullException("c");
64 foreach (double element in c) {
65 this.Add(element);
66 }
67 }
68
69 public DoubleVector(global::System.Collections.Generic.IEnumerable<double> c) : this() {
70 if (c == null)
71 throw new global::System.ArgumentNullException("c");
72 foreach (double element in c) {
73 this.Add(element);
74 }
75 }
76
77 public bool IsFixedSize {
78 get {
79 return false;
80 }
81 }
82
83 public bool IsReadOnly {
84 get {
85 return false;
86 }
87 }
88
89 public double this[int index] {
90 get {
91 return getitem(index);
92 }
93 set {
94 setitem(index, value);
95 }
96 }
97
98 public int Capacity {
99 get {
100 return (int)capacity();
101 }
102 set {
103 if (value < 0 || (uint)value < size())
104 throw new global::System.ArgumentOutOfRangeException("Capacity");
105 reserve((uint)value);
106 }
107 }
108
109 public bool IsEmpty {
110 get {
111 return empty();
112 }
113 }
114
115 public int Count {
116 get {
117 return (int)size();
118 }
119 }
120
121 public bool IsSynchronized {
122 get {
123 return false;
124 }
125 }
126
127 public void CopyTo(double[] array)
128 {
129 CopyTo(0, array, 0, this.Count);
130 }
131
132 public void CopyTo(double[] array, int arrayIndex)
133 {
134 CopyTo(0, array, arrayIndex, this.Count);
135 }
136
137 public void CopyTo(int index, double[] array, int arrayIndex, int count)
138 {
139 if (array == null)
140 throw new global::System.ArgumentNullException("array");
141 if (index < 0)
142 throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
143 if (arrayIndex < 0)
144 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
145 if (count < 0)
146 throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
147 if (array.Rank > 1)
148 throw new global::System.ArgumentException("Multi dimensional array.", "array");
149 if (index+count > this.Count || arrayIndex+count > array.Length)
150 throw new global::System.ArgumentException("Number of elements to copy is too large.");
151 for (int i=0; i<count; i++)
152 array.SetValue(getitemcopy(index+i), arrayIndex+i);
153 }
154
155 public double[] ToArray() {
156 double[] array = new double[this.Count];
157 this.CopyTo(array);
158 return array;
159 }
160
161 global::System.Collections.Generic.IEnumerator<double> global::System.Collections.Generic.IEnumerable<double>.GetEnumerator() {
162 return new DoubleVectorEnumerator(this);
163 }
164
165 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
166 return new DoubleVectorEnumerator(this);
167 }
168
169 public DoubleVectorEnumerator GetEnumerator() {
170 return new DoubleVectorEnumerator(this);
172
173 // Type-safe enumerator
178 public sealed class DoubleVectorEnumerator : global::System.Collections.IEnumerator
179 , global::System.Collections.Generic.IEnumerator<double>
181 private DoubleVector collectionRef;
182 private int currentIndex;
183 private object currentObject;
184 private int currentSize;
185
186 public DoubleVectorEnumerator(DoubleVector collection) {
187 collectionRef = collection;
188 currentIndex = -1;
189 currentObject = null;
190 currentSize = collectionRef.Count;
191 }
192
193 // Type-safe iterator Current
194 public double Current {
195 get {
196 if (currentIndex == -1)
197 throw new global::System.InvalidOperationException("Enumeration not started.");
198 if (currentIndex > currentSize - 1)
199 throw new global::System.InvalidOperationException("Enumeration finished.");
200 if (currentObject == null)
201 throw new global::System.InvalidOperationException("Collection modified.");
202 return (double)currentObject;
203 }
204 }
205
206 // Type-unsafe IEnumerator.Current
207 object global::System.Collections.IEnumerator.Current {
208 get {
209 return Current;
210 }
211 }
212
213 public bool MoveNext() {
214 int size = collectionRef.Count;
215 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
216 if (moveOkay) {
217 currentIndex++;
218 currentObject = collectionRef[currentIndex];
219 } else {
220 currentObject = null;
221 }
222 return moveOkay;
223 }
224
225 public void Reset() {
226 currentIndex = -1;
227 currentObject = null;
228 if (collectionRef.Count != currentSize) {
229 throw new global::System.InvalidOperationException("Collection modified.");
230 }
231 }
232
233 public void Dispose() {
234 currentIndex = -1;
235 currentObject = null;
236 }
237 }
238
239 public DoubleVector() : this(operations_research_linear_solverPINVOKE.new_DoubleVector__SWIG_0(), true) {
240 }
242 public DoubleVector(DoubleVector other) : this(operations_research_linear_solverPINVOKE.new_DoubleVector__SWIG_1(DoubleVector.getCPtr(other)), true) {
245
246 public void Clear() {
249
250 public void Add(double x) {
253
254 private uint size() {
256 return ret;
257 }
258
259 private bool empty() {
260 bool ret = operations_research_linear_solverPINVOKE.DoubleVector_empty(swigCPtr);
261 return ret;
262 }
263
264 private uint capacity() {
265 uint ret = operations_research_linear_solverPINVOKE.DoubleVector_capacity(swigCPtr);
266 return ret;
267 }
268
269 private void reserve(uint n) {
270 operations_research_linear_solverPINVOKE.DoubleVector_reserve(swigCPtr, n);
271 }
272
273 public DoubleVector(int capacity) : this(operations_research_linear_solverPINVOKE.new_DoubleVector__SWIG_2(capacity), true) {
274 if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
276
277 private double getitemcopy(int index) {
280 return ret;
281 }
282
283 private double getitem(int index) {
284 double ret = operations_research_linear_solverPINVOKE.DoubleVector_getitem(swigCPtr, index);
285 if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
286 return ret;
287 }
288
289 private void setitem(int index, double val) {
290 operations_research_linear_solverPINVOKE.DoubleVector_setitem(swigCPtr, index, val);
291 if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
292 }
293
294 public void AddRange(DoubleVector values) {
295 operations_research_linear_solverPINVOKE.DoubleVector_AddRange(swigCPtr, DoubleVector.getCPtr(values));
300 global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.DoubleVector_GetRange(swigCPtr, index, count);
301 DoubleVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new DoubleVector(cPtr, true);
303 return ret;
304 }
305
306 public void Insert(int index, double x) {
327 global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.DoubleVector_Repeat(value, count);
328 DoubleVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new DoubleVector(cPtr, true);
330 return ret;
331 }
332
333 public void Reverse() {
336
337 public void Reverse(int index, int count) {
349 return ret;
350 }
351
352 public int IndexOf(double value) {
354 return ret;
355 }
356
357 public int LastIndexOf(double value) {
359 return ret;
360 }
361
362 public bool Remove(double value) {
364 return ret;
365 }
366
367}
368
369}
DoubleVector GetRange(int index, int count)
void CopyTo(double[] array, int arrayIndex)
void SetRange(int index, DoubleVector values)
void InsertRange(int index, DoubleVector values)
void RemoveRange(int index, int count)
static DoubleVector Repeat(double value, int count)
static void DoubleVector_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void DoubleVector_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void DoubleVector_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
static void DoubleVector_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static global::System.IntPtr DoubleVector_Repeat(double jarg1, int jarg2)
static double DoubleVector_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static uint DoubleVector_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static int DoubleVector_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
static void DoubleVector_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static int DoubleVector_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
static void DoubleVector_Add(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
static bool DoubleVector_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
static bool DoubleVector_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
static global::System.IntPtr DoubleVector_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void DoubleVector_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static void DoubleVector_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void delete_DoubleVector(global::System.Runtime.InteropServices.HandleRef jarg1)
static void DoubleVector_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, double jarg3)