Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
MPConstraintVector.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 partial class MPConstraintVector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<Constraint>
14 {
15 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
16 protected bool swigCMemOwn;
17
18 internal MPConstraintVector(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(MPConstraintVector 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(MPConstraintVector 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 ~MPConstraintVector() {
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 MPConstraintVector(global::System.Collections.IEnumerable c) : this() {
62 if (c == null)
63 throw new global::System.ArgumentNullException("c");
64 foreach (Constraint element in c) {
65 this.Add(element);
66 }
67 }
68
69 public MPConstraintVector(global::System.Collections.Generic.IEnumerable<Constraint> c) : this() {
70 if (c == null)
71 throw new global::System.ArgumentNullException("c");
72 foreach (Constraint 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 Constraint 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(Constraint[] array)
128 {
129 CopyTo(0, array, 0, this.Count);
130 }
131
132 public void CopyTo(Constraint[] array, int arrayIndex)
133 {
134 CopyTo(0, array, arrayIndex, this.Count);
135 }
136
137 public void CopyTo(int index, Constraint[] 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 Constraint[] ToArray() {
156 Constraint[] array = new Constraint[this.Count];
157 this.CopyTo(array);
158 return array;
159 }
160
161 global::System.Collections.Generic.IEnumerator<Constraint> global::System.Collections.Generic.IEnumerable<Constraint>.GetEnumerator() {
162 return new MPConstraintVectorEnumerator(this);
163 }
164
165 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
166 return new MPConstraintVectorEnumerator(this);
167 }
168
169 public MPConstraintVectorEnumerator GetEnumerator() {
170 return new MPConstraintVectorEnumerator(this);
172
173 // Type-safe enumerator
178 public sealed class MPConstraintVectorEnumerator : global::System.Collections.IEnumerator
179 , global::System.Collections.Generic.IEnumerator<Constraint>
181 private MPConstraintVector collectionRef;
182 private int currentIndex;
183 private object currentObject;
184 private int currentSize;
185
187 collectionRef = collection;
188 currentIndex = -1;
189 currentObject = null;
190 currentSize = collectionRef.Count;
191 }
192
193 // Type-safe iterator Current
194 public Constraint 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 (Constraint)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 MPConstraintVector() : this(operations_research_linear_solverPINVOKE.new_MPConstraintVector__SWIG_0(), true) {
240 }
242 public MPConstraintVector(MPConstraintVector other) : this(operations_research_linear_solverPINVOKE.new_MPConstraintVector__SWIG_1(MPConstraintVector.getCPtr(other)), true) {
245
246 public void Clear() {
249
250 public void Add(Constraint x) {
253
254 private uint size() {
256 return ret;
257 }
258
259 private bool empty() {
260 bool ret = operations_research_linear_solverPINVOKE.MPConstraintVector_empty(swigCPtr);
261 return ret;
262 }
263
264 private uint capacity() {
265 uint ret = operations_research_linear_solverPINVOKE.MPConstraintVector_capacity(swigCPtr);
266 return ret;
267 }
268
269 private void reserve(uint n) {
270 operations_research_linear_solverPINVOKE.MPConstraintVector_reserve(swigCPtr, n);
271 }
272
273 public MPConstraintVector(int capacity) : this(operations_research_linear_solverPINVOKE.new_MPConstraintVector__SWIG_2(capacity), true) {
274 if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
276
277 private Constraint getitemcopy(int index) {
278 global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MPConstraintVector_getitemcopy(swigCPtr, index);
279 Constraint ret = (cPtr == global::System.IntPtr.Zero) ? null : new Constraint(cPtr, false);
281 return ret;
282 }
283
284 private Constraint getitem(int index) {
285 global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MPConstraintVector_getitem(swigCPtr, index);
286 Constraint ret = (cPtr == global::System.IntPtr.Zero) ? null : new Constraint(cPtr, false);
287 if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
288 return ret;
289 }
290
291 private void setitem(int index, Constraint val) {
292 operations_research_linear_solverPINVOKE.MPConstraintVector_setitem(swigCPtr, index, Constraint.getCPtr(val));
293 if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
294 }
295
296 public void AddRange(MPConstraintVector values) {
297 operations_research_linear_solverPINVOKE.MPConstraintVector_AddRange(swigCPtr, MPConstraintVector.getCPtr(values));
302 global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MPConstraintVector_GetRange(swigCPtr, index, count);
303 MPConstraintVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new MPConstraintVector(cPtr, true);
305 return ret;
306 }
307
308 public void Insert(int index, Constraint x) {
329 global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MPConstraintVector_Repeat(Constraint.getCPtr(value), count);
330 MPConstraintVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new MPConstraintVector(cPtr, true);
332 return ret;
333 }
334
335 public void Reverse() {
338
339 public void Reverse(int index, int count) {
351 return ret;
352 }
353
354 public int IndexOf(Constraint value) {
356 return ret;
357 }
358
359 public int LastIndexOf(Constraint value) {
361 return ret;
362 }
363
364 public bool Remove(Constraint value) {
366 return ret;
367 }
368
369}
370
371}
void InsertRange(int index, MPConstraintVector values)
void CopyTo(Constraint[] array, int arrayIndex)
MPConstraintVector GetRange(int index, int count)
void SetRange(int index, MPConstraintVector values)
static MPConstraintVector Repeat(Constraint value, int count)
static int MPConstraintVector_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void MPConstraintVector_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void MPConstraintVector_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void MPConstraintVector_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr MPConstraintVector_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void MPConstraintVector_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void MPConstraintVector_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static int MPConstraintVector_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void MPConstraintVector_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
static uint MPConstraintVector_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool MPConstraintVector_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void MPConstraintVector_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static global::System.IntPtr MPConstraintVector_Repeat(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void MPConstraintVector_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void MPConstraintVector_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void delete_MPConstraintVector(global::System.Runtime.InteropServices.HandleRef jarg1)
static bool MPConstraintVector_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static global::System.IntPtr MPConstraintVector_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)