DotNet Reference

DotNet Reference

IntVarVector.cs
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.12
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 
13 using System;
14 using System.Runtime.InteropServices;
15 using System.Collections;
16 using System.Collections.Generic;
17 
18 public partial class IntVarVector : global::System.IDisposable, global::System.Collections.IEnumerable
19  , global::System.Collections.Generic.IList<IntVar>
20  {
21  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
22  protected bool swigCMemOwn;
23 
24  internal IntVarVector(global::System.IntPtr cPtr, bool cMemoryOwn) {
25  swigCMemOwn = cMemoryOwn;
26  swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
27  }
28 
29  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(IntVarVector obj) {
30  return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
31  }
32 
33  ~IntVarVector() {
34  Dispose();
35  }
36 
37  public virtual void Dispose() {
38  lock(this) {
39  if (swigCPtr.Handle != global::System.IntPtr.Zero) {
40  if (swigCMemOwn) {
41  swigCMemOwn = false;
43  }
44  swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
45  }
46  global::System.GC.SuppressFinalize(this);
47  }
48  }
49 
50  public IntVarVector(global::System.Collections.ICollection c) : this() {
51  if (c == null)
52  throw new global::System.ArgumentNullException("c");
53  foreach (IntVar element in c) {
54  this.Add(element);
55  }
56  }
57 
58  public bool IsFixedSize {
59  get {
60  return false;
61  }
62  }
63 
64  public bool IsReadOnly {
65  get {
66  return false;
67  }
68  }
69 
70  public IntVar this[int index] {
71  get {
72  return getitem(index);
73  }
74  set {
75  setitem(index, value);
76  }
77  }
78 
79  public int Capacity {
80  get {
81  return (int)capacity();
82  }
83  set {
84  if (value < size())
85  throw new global::System.ArgumentOutOfRangeException("Capacity");
86  reserve((uint)value);
87  }
88  }
89 
90  public int Count {
91  get {
92  return (int)size();
93  }
94  }
95 
96  public bool IsSynchronized {
97  get {
98  return false;
99  }
100  }
101 
102  public void CopyTo(IntVar[] array)
103  {
104  CopyTo(0, array, 0, this.Count);
105  }
106 
107  public void CopyTo(IntVar[] array, int arrayIndex)
108  {
109  CopyTo(0, array, arrayIndex, this.Count);
110  }
111 
112  public void CopyTo(int index, IntVar[] array, int arrayIndex, int count)
113  {
114  if (array == null)
115  throw new global::System.ArgumentNullException("array");
116  if (index < 0)
117  throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
118  if (arrayIndex < 0)
119  throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
120  if (count < 0)
121  throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
122  if (array.Rank > 1)
123  throw new global::System.ArgumentException("Multi dimensional array.", "array");
124  if (index+count > this.Count || arrayIndex+count > array.Length)
125  throw new global::System.ArgumentException("Number of elements to copy is too large.");
126  for (int i=0; i<count; i++)
127  array.SetValue(getitemcopy(index+i), arrayIndex+i);
128  }
129 
130  global::System.Collections.Generic.IEnumerator<IntVar> global::System.Collections.Generic.IEnumerable<IntVar>.GetEnumerator() {
131  return new IntVarVectorEnumerator(this);
132  }
133 
134  global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
135  return new IntVarVectorEnumerator(this);
136  }
137 
139  return new IntVarVectorEnumerator(this);
140  }
141 
142  // Type-safe enumerator
147  public sealed class IntVarVectorEnumerator : global::System.Collections.IEnumerator
148  , global::System.Collections.Generic.IEnumerator<IntVar>
149  {
150  private IntVarVector collectionRef;
151  private int currentIndex;
152  private object currentObject;
153  private int currentSize;
154 
156  collectionRef = collection;
157  currentIndex = -1;
158  currentObject = null;
159  currentSize = collectionRef.Count;
160  }
161 
162  // Type-safe iterator Current
163  public IntVar Current {
164  get {
165  if (currentIndex == -1)
166  throw new global::System.InvalidOperationException("Enumeration not started.");
167  if (currentIndex > currentSize - 1)
168  throw new global::System.InvalidOperationException("Enumeration finished.");
169  if (currentObject == null)
170  throw new global::System.InvalidOperationException("Collection modified.");
171  return (IntVar)currentObject;
172  }
173  }
174 
175  // Type-unsafe IEnumerator.Current
176  object global::System.Collections.IEnumerator.Current {
177  get {
178  return Current;
179  }
180  }
181 
182  public bool MoveNext() {
183  int size = collectionRef.Count;
184  bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
185  if (moveOkay) {
186  currentIndex++;
187  currentObject = collectionRef[currentIndex];
188  } else {
189  currentObject = null;
190  }
191  return moveOkay;
192  }
193 
194  public void Reset() {
195  currentIndex = -1;
196  currentObject = null;
197  if (collectionRef.Count != currentSize) {
198  throw new global::System.InvalidOperationException("Collection modified.");
199  }
200  }
201 
202  public void Dispose() {
203  currentIndex = -1;
204  currentObject = null;
205  }
206  }
207 
208  public void Clear() {
210  }
211 
212  public void Add(IntVar x) {
214  }
215 
216  private uint size() {
218  return ret;
219  }
220 
221  private uint capacity() {
222  uint ret = operations_research_constraint_solverPINVOKE.IntVarVector_capacity(swigCPtr);
223  return ret;
224  }
225 
226  private void reserve(uint n) {
227  operations_research_constraint_solverPINVOKE.IntVarVector_reserve(swigCPtr, n);
228  }
229 
230  public IntVarVector() : this(operations_research_constraint_solverPINVOKE.new_IntVarVector__SWIG_0(), true) {
231  }
232 
233  public IntVarVector(IntVarVector other) : this(operations_research_constraint_solverPINVOKE.new_IntVarVector__SWIG_1(IntVarVector.getCPtr(other)), true) {
235  }
236 
237  public IntVarVector(int capacity) : this(operations_research_constraint_solverPINVOKE.new_IntVarVector__SWIG_2(capacity), true) {
239  }
240 
241  private IntVar getitemcopy(int index) {
242  global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVarVector_getitemcopy(swigCPtr, index);
243  IntVar ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVar(cPtr, false);
245  return ret;
246  }
247 
248  private IntVar getitem(int index) {
249  global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVarVector_getitem(swigCPtr, index);
250  IntVar ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVar(cPtr, false);
251  if (operations_research_constraint_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_constraint_solverPINVOKE.SWIGPendingException.Retrieve();
252  return ret;
253  }
254 
255  private void setitem(int index, IntVar val) {
256  operations_research_constraint_solverPINVOKE.IntVarVector_setitem(swigCPtr, index, IntVar.getCPtr(val));
257  if (operations_research_constraint_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_constraint_solverPINVOKE.SWIGPendingException.Retrieve();
258  }
259 
260  public void AddRange(IntVarVector values) {
263  }
264 
265  public IntVarVector GetRange(int index, int count) {
266  global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVarVector_GetRange(swigCPtr, index, count);
267  IntVarVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVarVector(cPtr, true);
269  return ret;
270  }
271 
272  public void Insert(int index, IntVar x) {
275  }
276 
277  public void InsertRange(int index, IntVarVector values) {
280  }
281 
282  public void RemoveAt(int index) {
285  }
286 
287  public void RemoveRange(int index, int count) {
290  }
291 
292  public static IntVarVector Repeat(IntVar value, int count) {
293  global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVarVector_Repeat(IntVar.getCPtr(value), count);
294  IntVarVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVarVector(cPtr, true);
296  return ret;
297  }
298 
299  public void Reverse() {
301  }
302 
303  public void Reverse(int index, int count) {
306  }
307 
308  public void SetRange(int index, IntVarVector values) {
311  }
312 
313  public bool Contains(IntVar value) {
315  return ret;
316  }
317 
318  public int IndexOf(IntVar value) {
320  return ret;
321  }
322 
323  public int LastIndexOf(IntVar value) {
325  return ret;
326  }
327 
328  public bool Remove(IntVar value) {
329  bool ret = operations_research_constraint_solverPINVOKE.IntVarVector_Remove(swigCPtr, IntVar.getCPtr(value));
330  return ret;
331  }
332 
333 }
334 
335 }
static uint IntVarVector_size(global::System.Runtime.InteropServices.HandleRef jarg1)
int IndexOf(IntVar value)
Definition: IntVar.cs:18
static bool IntVarVector_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
bool IsSynchronized
Definition: IntVarVector.cs:96
static void IntVarVector_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
void Reset()
static void IntVarVector_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static IntVarVector Repeat(IntVar value, int count)
bool IsFixedSize
Definition: IntVarVector.cs:58
IntVarVector(int capacity)
static void IntVarVector_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
void CopyTo(IntVar[] array)
bool Remove(IntVar value)
static bool Pending
Definition: Assignment.cs:11
Definition: IntVarVector.cs:18
static bool IntVarVector_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void IntVarVector_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static global::System.IntPtr IntVarVector_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
IntVarVectorEnumerator(IntVarVector collection)
void InsertRange(int index, IntVarVector values)
bool IsReadOnly
Definition: IntVarVector.cs:64
static void IntVarVector_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
int LastIndexOf(IntVar value)
static int IntVarVector_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void delete_IntVarVector(global::System.Runtime.InteropServices.HandleRef jarg1)
IntVarVector(global::System.Collections.ICollection c)
Definition: IntVarVector.cs:50
void RemoveAt(int index)
static void IntVarVector_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void IntVarVector_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
void SetRange(int index, IntVarVector values)
void CopyTo(int index, IntVar[] array, int arrayIndex, int count)
void CopyTo(IntVar[] array, int arrayIndex)
IntVarVector()
static void IntVarVector_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
bool MoveNext()
static global::System.IntPtr IntVarVector_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void IntVarVector_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
IntVarVectorEnumerator GetEnumerator()
IntVarVector GetRange(int index, int count)
virtual void SetValue(long v)
Definition: IntExpr.cs:85
static void IntVarVector_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
IntVar Current
void Reverse(int index, int count)
int Capacity
Definition: IntVarVector.cs:79
Note that the IEnumerator documentation requires an InvalidOperationException to be thrown whenever t...
void Insert(int index, IntVar x)
void Reverse()
void AddRange(IntVarVector values)
void RemoveRange(int index, int count)
static int IntVarVector_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
bool swigCMemOwn
Definition: IntVarVector.cs:22
IntVarVector(IntVarVector other)
static global::System.Exception Retrieve()
static global::System.IntPtr IntVarVector_Repeat(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
void Add(IntVar x)
void Clear()
bool Contains(IntVar value)
virtual void Dispose()
Definition: IntVarVector.cs:37
void Dispose()
int Count
Definition: IntVarVector.cs:90