DotNet Reference

DotNet Reference

MPVariableVector.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 public partial class MPVariableVector : global::System.IDisposable, global::System.Collections.IEnumerable
14  , global::System.Collections.Generic.IList<Variable>
15  {
16  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
17  protected bool swigCMemOwn;
18 
19  internal MPVariableVector(global::System.IntPtr cPtr, bool cMemoryOwn) {
20  swigCMemOwn = cMemoryOwn;
21  swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
22  }
23 
24  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(MPVariableVector obj) {
25  return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
26  }
27 
28  ~MPVariableVector() {
29  Dispose();
30  }
31 
32  public virtual void Dispose() {
33  lock(this) {
34  if (swigCPtr.Handle != global::System.IntPtr.Zero) {
35  if (swigCMemOwn) {
36  swigCMemOwn = false;
38  }
39  swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
40  }
41  global::System.GC.SuppressFinalize(this);
42  }
43  }
44 
45  public MPVariableVector(global::System.Collections.ICollection c) : this() {
46  if (c == null)
47  throw new global::System.ArgumentNullException("c");
48  foreach (Variable element in c) {
49  this.Add(element);
50  }
51  }
52 
53  public bool IsFixedSize {
54  get {
55  return false;
56  }
57  }
58 
59  public bool IsReadOnly {
60  get {
61  return false;
62  }
63  }
64 
65  public Variable this[int index] {
66  get {
67  return getitem(index);
68  }
69  set {
70  setitem(index, value);
71  }
72  }
73 
74  public int Capacity {
75  get {
76  return (int)capacity();
77  }
78  set {
79  if (value < size())
80  throw new global::System.ArgumentOutOfRangeException("Capacity");
81  reserve((uint)value);
82  }
83  }
84 
85  public int Count {
86  get {
87  return (int)size();
88  }
89  }
90 
91  public bool IsSynchronized {
92  get {
93  return false;
94  }
95  }
96 
97  public void CopyTo(Variable[] array)
98  {
99  CopyTo(0, array, 0, this.Count);
100  }
101 
102  public void CopyTo(Variable[] array, int arrayIndex)
103  {
104  CopyTo(0, array, arrayIndex, this.Count);
105  }
106 
107  public void CopyTo(int index, Variable[] array, int arrayIndex, int count)
108  {
109  if (array == null)
110  throw new global::System.ArgumentNullException("array");
111  if (index < 0)
112  throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
113  if (arrayIndex < 0)
114  throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
115  if (count < 0)
116  throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
117  if (array.Rank > 1)
118  throw new global::System.ArgumentException("Multi dimensional array.", "array");
119  if (index+count > this.Count || arrayIndex+count > array.Length)
120  throw new global::System.ArgumentException("Number of elements to copy is too large.");
121  for (int i=0; i<count; i++)
122  array.SetValue(getitemcopy(index+i), arrayIndex+i);
123  }
124 
125  global::System.Collections.Generic.IEnumerator<Variable> global::System.Collections.Generic.IEnumerable<Variable>.GetEnumerator() {
126  return new MPVariableVectorEnumerator(this);
127  }
128 
129  global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
130  return new MPVariableVectorEnumerator(this);
131  }
132 
134  return new MPVariableVectorEnumerator(this);
135  }
136 
137  // Type-safe enumerator
142  public sealed class MPVariableVectorEnumerator : global::System.Collections.IEnumerator
143  , global::System.Collections.Generic.IEnumerator<Variable>
144  {
145  private MPVariableVector collectionRef;
146  private int currentIndex;
147  private object currentObject;
148  private int currentSize;
149 
151  collectionRef = collection;
152  currentIndex = -1;
153  currentObject = null;
154  currentSize = collectionRef.Count;
155  }
156 
157  // Type-safe iterator Current
158  public Variable Current {
159  get {
160  if (currentIndex == -1)
161  throw new global::System.InvalidOperationException("Enumeration not started.");
162  if (currentIndex > currentSize - 1)
163  throw new global::System.InvalidOperationException("Enumeration finished.");
164  if (currentObject == null)
165  throw new global::System.InvalidOperationException("Collection modified.");
166  return (Variable)currentObject;
167  }
168  }
169 
170  // Type-unsafe IEnumerator.Current
171  object global::System.Collections.IEnumerator.Current {
172  get {
173  return Current;
174  }
175  }
176 
177  public bool MoveNext() {
178  int size = collectionRef.Count;
179  bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
180  if (moveOkay) {
181  currentIndex++;
182  currentObject = collectionRef[currentIndex];
183  } else {
184  currentObject = null;
185  }
186  return moveOkay;
187  }
188 
189  public void Reset() {
190  currentIndex = -1;
191  currentObject = null;
192  if (collectionRef.Count != currentSize) {
193  throw new global::System.InvalidOperationException("Collection modified.");
194  }
195  }
196 
197  public void Dispose() {
198  currentIndex = -1;
199  currentObject = null;
200  }
201  }
202 
203  public void Clear() {
205  }
206 
207  public void Add(Variable x) {
209  }
210 
211  private uint size() {
213  return ret;
214  }
215 
216  private uint capacity() {
217  uint ret = operations_research_linear_solverPINVOKE.MPVariableVector_capacity(swigCPtr);
218  return ret;
219  }
220 
221  private void reserve(uint n) {
222  operations_research_linear_solverPINVOKE.MPVariableVector_reserve(swigCPtr, n);
223  }
224 
225  public MPVariableVector() : this(operations_research_linear_solverPINVOKE.new_MPVariableVector__SWIG_0(), true) {
226  }
227 
228  public MPVariableVector(MPVariableVector other) : this(operations_research_linear_solverPINVOKE.new_MPVariableVector__SWIG_1(MPVariableVector.getCPtr(other)), true) {
230  }
231 
232  public MPVariableVector(int capacity) : this(operations_research_linear_solverPINVOKE.new_MPVariableVector__SWIG_2(capacity), true) {
234  }
235 
236  private Variable getitemcopy(int index) {
237  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MPVariableVector_getitemcopy(swigCPtr, index);
238  Variable ret = (cPtr == global::System.IntPtr.Zero) ? null : new Variable(cPtr, false);
240  return ret;
241  }
242 
243  private Variable getitem(int index) {
244  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MPVariableVector_getitem(swigCPtr, index);
245  Variable ret = (cPtr == global::System.IntPtr.Zero) ? null : new Variable(cPtr, false);
246  if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
247  return ret;
248  }
249 
250  private void setitem(int index, Variable val) {
251  operations_research_linear_solverPINVOKE.MPVariableVector_setitem(swigCPtr, index, Variable.getCPtr(val));
252  if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
253  }
254 
255  public void AddRange(MPVariableVector values) {
258  }
259 
260  public MPVariableVector GetRange(int index, int count) {
261  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MPVariableVector_GetRange(swigCPtr, index, count);
262  MPVariableVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new MPVariableVector(cPtr, true);
264  return ret;
265  }
266 
267  public void Insert(int index, Variable x) {
270  }
271 
272  public void InsertRange(int index, MPVariableVector values) {
275  }
276 
277  public void RemoveAt(int index) {
280  }
281 
282  public void RemoveRange(int index, int count) {
285  }
286 
287  public static MPVariableVector Repeat(Variable value, int count) {
288  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MPVariableVector_Repeat(Variable.getCPtr(value), count);
289  MPVariableVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new MPVariableVector(cPtr, true);
291  return ret;
292  }
293 
294  public void Reverse() {
296  }
297 
298  public void Reverse(int index, int count) {
301  }
302 
303  public void SetRange(int index, MPVariableVector values) {
306  }
307 
308  public bool Contains(Variable value) {
310  return ret;
311  }
312 
313  public int IndexOf(Variable value) {
315  return ret;
316  }
317 
318  public int LastIndexOf(Variable value) {
320  return ret;
321  }
322 
323  public bool Remove(Variable value) {
325  return ret;
326  }
327 
328 }
329 
330 }
static bool MPVariableVector_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
Definition: Variable.cs:13
static global::System.IntPtr MPVariableVector_Repeat(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static int MPVariableVector_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void MPVariableVector_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void MPVariableVector_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
void InsertRange(int index, MPVariableVector values)
int IndexOf(Variable value)
MPVariableVectorEnumerator GetEnumerator()
MPVariableVector()
static void delete_MPVariableVector(global::System.Runtime.InteropServices.HandleRef jarg1)
int Capacity
void SetRange(int index, MPVariableVector values)
static bool MPVariableVector_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
void Clear()
static global::System.IntPtr MPVariableVector_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
bool MoveNext()
static bool Pending
void CopyTo(Variable[] array, int arrayIndex)
void CopyTo(Variable[] array)
static void MPVariableVector_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
bool IsSynchronized
bool IsReadOnly
static void MPVariableVector_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void MPVariableVector_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void MPVariableVector_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
int LastIndexOf(Variable value)
bool swigCMemOwn
MPVariableVector(global::System.Collections.ICollection c)
void Reverse(int index, int count)
MPVariableVector(MPVariableVector other)
MPVariableVector GetRange(int index, int count)
static global::System.IntPtr MPVariableVector_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void MPVariableVector_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
bool Contains(Variable value)
bool Remove(Variable value)
static uint MPVariableVector_size(global::System.Runtime.InteropServices.HandleRef jarg1)
Variable Current
MPVariableVectorEnumerator(MPVariableVector collection)
bool IsFixedSize
void RemoveAt(int index)
void AddRange(MPVariableVector values)
MPVariableVector(int capacity)
Note that the IEnumerator documentation requires an InvalidOperationException to be thrown whenever t...
static void MPVariableVector_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static global::System.Exception Retrieve()
void Reset()
static void MPVariableVector_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
void Add(Variable x)
void Reverse()
void RemoveRange(int index, int count)
void Dispose()
virtual void Dispose()
static int MPVariableVector_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void MPVariableVector_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
void Insert(int index, Variable x)
void CopyTo(int index, Variable[] array, int arrayIndex, int count)
static MPVariableVector Repeat(Variable value, int count)
int Count