Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
Int64Vector.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 Int64Vector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<long>
14 {
15 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
16 protected bool swigCMemOwn;
17
18 internal Int64Vector(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(Int64Vector 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(Int64Vector 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 ~Int64Vector() {
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 Int64Vector(global::System.Collections.IEnumerable c) : this() {
62 if (c == null)
63 throw new global::System.ArgumentNullException("c");
64 foreach (long element in c) {
65 this.Add(element);
66 }
67 }
68
69 public Int64Vector(global::System.Collections.Generic.IEnumerable<long> c) : this() {
70 if (c == null)
71 throw new global::System.ArgumentNullException("c");
72 foreach (long 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 long 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(long[] array)
128 {
129 CopyTo(0, array, 0, this.Count);
130 }
131
132 public void CopyTo(long[] array, int arrayIndex)
133 {
134 CopyTo(0, array, arrayIndex, this.Count);
135 }
136
137 public void CopyTo(int index, long[] 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 long[] ToArray() {
156 long[] array = new long[this.Count];
157 this.CopyTo(array);
158 return array;
159 }
160
161 global::System.Collections.Generic.IEnumerator<long> global::System.Collections.Generic.IEnumerable<long>.GetEnumerator() {
162 return new Int64VectorEnumerator(this);
163 }
164
165 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
166 return new Int64VectorEnumerator(this);
167 }
168
169 public Int64VectorEnumerator GetEnumerator() {
170 return new Int64VectorEnumerator(this);
172
173 // Type-safe enumerator
178 public sealed class Int64VectorEnumerator : global::System.Collections.IEnumerator
179 , global::System.Collections.Generic.IEnumerator<long>
181 private Int64Vector collectionRef;
182 private int currentIndex;
183 private object currentObject;
184 private int currentSize;
185
186 public Int64VectorEnumerator(Int64Vector collection) {
187 collectionRef = collection;
188 currentIndex = -1;
189 currentObject = null;
190 currentSize = collectionRef.Count;
191 }
192
193 // Type-safe iterator Current
194 public long 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 (long)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 Int64Vector() : this(operations_research_algorithmsPINVOKE.new_Int64Vector__SWIG_0(), true) {
240 }
242 public Int64Vector(Int64Vector other) : this(operations_research_algorithmsPINVOKE.new_Int64Vector__SWIG_1(Int64Vector.getCPtr(other)), true) {
245
246 public void Clear() {
249
250 public void Add(long x) {
253
254 private uint size() {
256 return ret;
257 }
258
259 private bool empty() {
260 bool ret = operations_research_algorithmsPINVOKE.Int64Vector_empty(swigCPtr);
261 return ret;
262 }
263
264 private uint capacity() {
265 uint ret = operations_research_algorithmsPINVOKE.Int64Vector_capacity(swigCPtr);
266 return ret;
267 }
268
269 private void reserve(uint n) {
270 operations_research_algorithmsPINVOKE.Int64Vector_reserve(swigCPtr, n);
271 }
272
273 public Int64Vector(int capacity) : this(operations_research_algorithmsPINVOKE.new_Int64Vector__SWIG_2(capacity), true) {
274 if (operations_research_algorithmsPINVOKE.SWIGPendingException.Pending) throw operations_research_algorithmsPINVOKE.SWIGPendingException.Retrieve();
276
277 private long getitemcopy(int index) {
280 return ret;
281 }
282
283 private long getitem(int index) {
284 long ret = operations_research_algorithmsPINVOKE.Int64Vector_getitem(swigCPtr, index);
285 if (operations_research_algorithmsPINVOKE.SWIGPendingException.Pending) throw operations_research_algorithmsPINVOKE.SWIGPendingException.Retrieve();
286 return ret;
287 }
288
289 private void setitem(int index, long val) {
290 operations_research_algorithmsPINVOKE.Int64Vector_setitem(swigCPtr, index, val);
291 if (operations_research_algorithmsPINVOKE.SWIGPendingException.Pending) throw operations_research_algorithmsPINVOKE.SWIGPendingException.Retrieve();
292 }
293
294 public void AddRange(Int64Vector values) {
295 operations_research_algorithmsPINVOKE.Int64Vector_AddRange(swigCPtr, Int64Vector.getCPtr(values));
300 global::System.IntPtr cPtr = operations_research_algorithmsPINVOKE.Int64Vector_GetRange(swigCPtr, index, count);
301 Int64Vector ret = (cPtr == global::System.IntPtr.Zero) ? null : new Int64Vector(cPtr, true);
303 return ret;
304 }
305
306 public void Insert(int index, long x) {
327 global::System.IntPtr cPtr = operations_research_algorithmsPINVOKE.Int64Vector_Repeat(value, count);
328 Int64Vector ret = (cPtr == global::System.IntPtr.Zero) ? null : new Int64Vector(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(long value) {
354 return ret;
355 }
356
357 public int LastIndexOf(long value) {
359 return ret;
360 }
361
362 public bool Remove(long value) {
364 return ret;
365 }
366
367}
368
369}
void CopyTo(long[] array, int arrayIndex)
Int64Vector GetRange(int index, int count)
void RemoveRange(int index, int count)
void SetRange(int index, Int64Vector values)
void InsertRange(int index, Int64Vector values)
static Int64Vector Repeat(long value, int count)
void AddRange(Int64Vector values)
static void Int64Vector_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void Int64Vector_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
static int Int64Vector_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static global::System.IntPtr Int64Vector_Repeat(long jarg1, int jarg2)
static void Int64Vector_Add(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void Int64Vector_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void Int64Vector_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, long jarg3)
static uint Int64Vector_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool Int64Vector_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void Int64Vector_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static bool Int64Vector_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static int Int64Vector_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void Int64Vector_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void delete_Int64Vector(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr Int64Vector_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void Int64Vector_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static long Int64Vector_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void Int64Vector_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)