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
11namespace Google.OrTools.Util {
12
13using System;
14using System.Runtime.InteropServices;
15using System.Collections;
16
17public partial class Int64Vector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<long>
18 {
19 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
20 protected bool swigCMemOwn;
21
22 internal Int64Vector(global::System.IntPtr cPtr, bool cMemoryOwn) {
23 swigCMemOwn = cMemoryOwn;
24 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
25 }
26
27 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Int64Vector obj) {
28 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
29 }
30
31 internal static global::System.Runtime.InteropServices.HandleRef swigRelease(Int64Vector obj) {
32 if (obj != null) {
33 if (!obj.swigCMemOwn)
34 throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
35 global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
36 obj.swigCMemOwn = false;
37 obj.Dispose();
38 return ptr;
39 } else {
40 return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
41 }
42 }
43
44 ~Int64Vector() {
45 Dispose(false);
46 }
47
48 public void Dispose() {
49 Dispose(true);
50 global::System.GC.SuppressFinalize(this);
51 }
52
53 protected virtual void Dispose(bool disposing) {
54 lock(this) {
55 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
56 if (swigCMemOwn) {
57 swigCMemOwn = false;
59 }
60 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
61 }
62 }
63 }
64
65 public Int64Vector(global::System.Collections.IEnumerable c) : this() {
66 if (c == null)
67 throw new global::System.ArgumentNullException("c");
68 foreach (long element in c) {
69 this.Add(element);
70 }
71 }
72
73 public Int64Vector(global::System.Collections.Generic.IEnumerable<long> c) : this() {
74 if (c == null)
75 throw new global::System.ArgumentNullException("c");
76 foreach (long element in c) {
77 this.Add(element);
78 }
79 }
80
81 public bool IsFixedSize {
82 get {
83 return false;
84 }
85 }
86
87 public bool IsReadOnly {
88 get {
89 return false;
90 }
91 }
92
93 public long this[int index] {
94 get {
95 return getitem(index);
96 }
97 set {
98 setitem(index, value);
99 }
100 }
101
102 public int Capacity {
103 get {
104 return (int)capacity();
105 }
106 set {
107 if (value < 0 || (uint)value < size())
108 throw new global::System.ArgumentOutOfRangeException("Capacity");
109 reserve((uint)value);
110 }
111 }
112
113 public bool IsEmpty {
114 get {
115 return empty();
116 }
117 }
118
119 public int Count {
120 get {
121 return (int)size();
122 }
123 }
124
125 public bool IsSynchronized {
126 get {
127 return false;
128 }
129 }
130
131 public void CopyTo(long[] array)
132 {
133 CopyTo(0, array, 0, this.Count);
134 }
135
136 public void CopyTo(long[] array, int arrayIndex)
137 {
138 CopyTo(0, array, arrayIndex, this.Count);
139 }
140
141 public void CopyTo(int index, long[] array, int arrayIndex, int count)
142 {
143 if (array == null)
144 throw new global::System.ArgumentNullException("array");
145 if (index < 0)
146 throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
147 if (arrayIndex < 0)
148 throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
149 if (count < 0)
150 throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
151 if (array.Rank > 1)
152 throw new global::System.ArgumentException("Multi dimensional array.", "array");
153 if (index+count > this.Count || arrayIndex+count > array.Length)
154 throw new global::System.ArgumentException("Number of elements to copy is too large.");
155 for (int i=0; i<count; i++)
156 array.SetValue(getitemcopy(index+i), arrayIndex+i);
157 }
158
159 public long[] ToArray() {
160 long[] array = new long[this.Count];
161 this.CopyTo(array);
162 return array;
163 }
164
165 global::System.Collections.Generic.IEnumerator<long> global::System.Collections.Generic.IEnumerable<long>.GetEnumerator() {
166 return new Int64VectorEnumerator(this);
167 }
168
169 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
170 return new Int64VectorEnumerator(this);
171 }
172
173 public Int64VectorEnumerator GetEnumerator() {
174 return new Int64VectorEnumerator(this);
176
177 // Type-safe enumerator
182 public sealed class Int64VectorEnumerator : global::System.Collections.IEnumerator
183 , global::System.Collections.Generic.IEnumerator<long>
185 private Int64Vector collectionRef;
186 private int currentIndex;
187 private object currentObject;
188 private int currentSize;
189
190 public Int64VectorEnumerator(Int64Vector collection) {
191 collectionRef = collection;
192 currentIndex = -1;
193 currentObject = null;
194 currentSize = collectionRef.Count;
195 }
196
197 // Type-safe iterator Current
198 public long Current {
199 get {
200 if (currentIndex == -1)
201 throw new global::System.InvalidOperationException("Enumeration not started.");
202 if (currentIndex > currentSize - 1)
203 throw new global::System.InvalidOperationException("Enumeration finished.");
204 if (currentObject == null)
205 throw new global::System.InvalidOperationException("Collection modified.");
206 return (long)currentObject;
207 }
208 }
209
210 // Type-unsafe IEnumerator.Current
211 object global::System.Collections.IEnumerator.Current {
212 get {
213 return Current;
214 }
215 }
216
217 public bool MoveNext() {
218 int size = collectionRef.Count;
219 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
220 if (moveOkay) {
221 currentIndex++;
222 currentObject = collectionRef[currentIndex];
223 } else {
224 currentObject = null;
225 }
226 return moveOkay;
227 }
228
229 public void Reset() {
230 currentIndex = -1;
231 currentObject = null;
232 if (collectionRef.Count != currentSize) {
233 throw new global::System.InvalidOperationException("Collection modified.");
234 }
235 }
236
237 public void Dispose() {
238 currentIndex = -1;
239 currentObject = null;
240 }
241 }
242
243 public Int64Vector() : this(operations_research_utilPINVOKE.new_Int64Vector__SWIG_0(), true) {
244 }
246 public Int64Vector(Int64Vector other) : this(operations_research_utilPINVOKE.new_Int64Vector__SWIG_1(Int64Vector.getCPtr(other)), true) {
249
250 public void Clear() {
253
254 public void Add(long x) {
257
258 private uint size() {
260 return ret;
261 }
262
263 private bool empty() {
264 bool ret = operations_research_utilPINVOKE.Int64Vector_empty(swigCPtr);
265 return ret;
266 }
267
268 private uint capacity() {
269 uint ret = operations_research_utilPINVOKE.Int64Vector_capacity(swigCPtr);
270 return ret;
271 }
272
273 private void reserve(uint n) {
274 operations_research_utilPINVOKE.Int64Vector_reserve(swigCPtr, n);
275 }
276
277 public Int64Vector(int capacity) : this(operations_research_utilPINVOKE.new_Int64Vector__SWIG_2(capacity), true) {
278 if (operations_research_utilPINVOKE.SWIGPendingException.Pending) throw operations_research_utilPINVOKE.SWIGPendingException.Retrieve();
280
281 private long getitemcopy(int index) {
284 return ret;
285 }
286
287 private long getitem(int index) {
288 long ret = operations_research_utilPINVOKE.Int64Vector_getitem(swigCPtr, index);
289 if (operations_research_utilPINVOKE.SWIGPendingException.Pending) throw operations_research_utilPINVOKE.SWIGPendingException.Retrieve();
290 return ret;
291 }
292
293 private void setitem(int index, long val) {
294 operations_research_utilPINVOKE.Int64Vector_setitem(swigCPtr, index, val);
295 if (operations_research_utilPINVOKE.SWIGPendingException.Pending) throw operations_research_utilPINVOKE.SWIGPendingException.Retrieve();
296 }
297
298 public void AddRange(Int64Vector values) {
299 operations_research_utilPINVOKE.Int64Vector_AddRange(swigCPtr, Int64Vector.getCPtr(values));
304 global::System.IntPtr cPtr = operations_research_utilPINVOKE.Int64Vector_GetRange(swigCPtr, index, count);
305 Int64Vector ret = (cPtr == global::System.IntPtr.Zero) ? null : new Int64Vector(cPtr, true);
307 return ret;
308 }
309
310 public void Insert(int index, long x) {
331 global::System.IntPtr cPtr = operations_research_utilPINVOKE.Int64Vector_Repeat(value, count);
332 Int64Vector ret = (cPtr == global::System.IntPtr.Zero) ? null : new Int64Vector(cPtr, true);
334 return ret;
335 }
336
337 public void Reverse() {
340
341 public void Reverse(int index, int count) {
347 operations_research_utilPINVOKE.Int64Vector_SetRange(swigCPtr, index, Int64Vector.getCPtr(values));
352 bool ret = operations_research_utilPINVOKE.Int64Vector_Contains(swigCPtr, value);
353 return ret;
354 }
355
356 public int IndexOf(long value) {
357 int ret = operations_research_utilPINVOKE.Int64Vector_IndexOf(swigCPtr, value);
358 return ret;
359 }
360
361 public int LastIndexOf(long value) {
363 return ret;
364 }
365
366 public bool Remove(long value) {
367 bool ret = operations_research_utilPINVOKE.Int64Vector_Remove(swigCPtr, value);
368 return ret;
369 }
370
371}
372
373}
void RemoveRange(int index, int count)
void InsertRange(int index, Int64Vector values)
void SetRange(int index, Int64Vector values)
void CopyTo(long[] array, int arrayIndex)
void AddRange(Int64Vector values)
static Int64Vector Repeat(long value, int count)
void Insert(int index, long x)
Int64Vector GetRange(int index, int count)
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_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
static int Int64Vector_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void Int64Vector_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static void Int64Vector_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, long jarg3)
static void Int64Vector_Add(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static long Int64Vector_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static uint Int64Vector_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static void Int64Vector_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static int Int64Vector_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void Int64Vector_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void Int64Vector_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void Int64Vector_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static global::System.IntPtr Int64Vector_Repeat(long jarg1, int jarg2)
static bool Int64Vector_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static bool Int64Vector_Remove(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)