MpDoubleVector.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 MpDoubleVector : global::System.IDisposable, global::System.Collections.IEnumerable
14  , global::System.Collections.Generic.IList<double>
15  {
16  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
17  protected bool swigCMemOwn;
18 
19  internal MpDoubleVector(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(MpDoubleVector obj) {
25  return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
26  }
27 
28  ~MpDoubleVector() {
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 MpDoubleVector(global::System.Collections.ICollection c) : this() {
46  if (c == null)
47  throw new global::System.ArgumentNullException("c");
48  foreach (double 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 double 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(double[] array)
98  {
99  CopyTo(0, array, 0, this.Count);
100  }
101 
102  public void CopyTo(double[] array, int arrayIndex)
103  {
104  CopyTo(0, array, arrayIndex, this.Count);
105  }
106 
107  public void CopyTo(int index, double[] 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<double> global::System.Collections.Generic.IEnumerable<double>.GetEnumerator() {
126  return new MpDoubleVectorEnumerator(this);
127  }
128 
129  global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
130  return new MpDoubleVectorEnumerator(this);
131  }
132 
134  return new MpDoubleVectorEnumerator(this);
135  }
136 
137  // Type-safe enumerator
142  public sealed class MpDoubleVectorEnumerator : global::System.Collections.IEnumerator
143  , global::System.Collections.Generic.IEnumerator<double>
144  {
145  private MpDoubleVector 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 double 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 (double)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(double x) {
209  }
210 
211  private uint size() {
213  return ret;
214  }
215 
216  private uint capacity() {
217  uint ret = operations_research_linear_solverPINVOKE.MpDoubleVector_capacity(swigCPtr);
218  return ret;
219  }
220 
221  private void reserve(uint n) {
222  operations_research_linear_solverPINVOKE.MpDoubleVector_reserve(swigCPtr, n);
223  }
224 
225  public MpDoubleVector() : this(operations_research_linear_solverPINVOKE.new_MpDoubleVector__SWIG_0(), true) {
226  }
227 
228  public MpDoubleVector(MpDoubleVector other) : this(operations_research_linear_solverPINVOKE.new_MpDoubleVector__SWIG_1(MpDoubleVector.getCPtr(other)), true) {
230  }
231 
232  public MpDoubleVector(int capacity) : this(operations_research_linear_solverPINVOKE.new_MpDoubleVector__SWIG_2(capacity), true) {
234  }
235 
236  private double getitemcopy(int index) {
239  return ret;
240  }
241 
242  private double getitem(int index) {
243  double ret = operations_research_linear_solverPINVOKE.MpDoubleVector_getitem(swigCPtr, index);
244  if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
245  return ret;
246  }
247 
248  private void setitem(int index, double val) {
249  operations_research_linear_solverPINVOKE.MpDoubleVector_setitem(swigCPtr, index, val);
250  if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending) throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
251  }
252 
253  public void AddRange(MpDoubleVector values) {
256  }
257 
258  public MpDoubleVector GetRange(int index, int count) {
259  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MpDoubleVector_GetRange(swigCPtr, index, count);
260  MpDoubleVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new MpDoubleVector(cPtr, true);
262  return ret;
263  }
264 
265  public void Insert(int index, double x) {
268  }
269 
270  public void InsertRange(int index, MpDoubleVector values) {
273  }
274 
275  public void RemoveAt(int index) {
278  }
279 
280  public void RemoveRange(int index, int count) {
283  }
284 
285  public static MpDoubleVector Repeat(double value, int count) {
286  global::System.IntPtr cPtr = operations_research_linear_solverPINVOKE.MpDoubleVector_Repeat(value, count);
287  MpDoubleVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new MpDoubleVector(cPtr, true);
289  return ret;
290  }
291 
292  public void Reverse() {
294  }
295 
296  public void Reverse(int index, int count) {
299  }
300 
301  public void SetRange(int index, MpDoubleVector values) {
304  }
305 
306  public bool Contains(double value) {
308  return ret;
309  }
310 
311  public int IndexOf(double value) {
313  return ret;
314  }
315 
316  public int LastIndexOf(double value) {
318  return ret;
319  }
320 
321  public bool Remove(double value) {
323  return ret;
324  }
325 
326 }
327 
328 }
void AddRange(MpDoubleVector values)
static void MpDoubleVector_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
void CopyTo(int index, double[] array, int arrayIndex, int count)
static bool MpDoubleVector_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
static int MpDoubleVector_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
static MpDoubleVector Repeat(double value, int count)
static void MpDoubleVector_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
MpDoubleVector(global::System.Collections.ICollection c)
static void MpDoubleVector_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, double jarg3)
MpDoubleVector GetRange(int index, int count)
static uint MpDoubleVector_size(global::System.Runtime.InteropServices.HandleRef jarg1)
static void MpDoubleVector_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
void RemoveRange(int index, int count)
static void MpDoubleVector_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void MpDoubleVector_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
void CopyTo(double[] array, int arrayIndex)
static double MpDoubleVector_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
static void MpDoubleVector_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
static void MpDoubleVector_Add(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
void InsertRange(int index, MpDoubleVector values)
static void delete_MpDoubleVector(global::System.Runtime.InteropServices.HandleRef jarg1)
static int MpDoubleVector_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
static global::System.IntPtr MpDoubleVector_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static void MpDoubleVector_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
static global::System.IntPtr MpDoubleVector_Repeat(double jarg1, int jarg2)
static void MpDoubleVector_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
MpDoubleVectorEnumerator GetEnumerator()
static bool MpDoubleVector_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2)
void SetRange(int index, MpDoubleVector values)
Note that the IEnumerator documentation requires an InvalidOperationException to be thrown whenever t...