DotNet Reference

DotNet Reference

UtilInt64Vector.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 4.0.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 
11 namespace Google.OrTools.Util {
12 
13 using System;
14 using System.Runtime.InteropServices;
15 using System.Collections;
16 
17 public class UtilInt64Vector : 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 UtilInt64Vector(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(UtilInt64Vector obj) {
28  return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
29  }
30 
31  ~UtilInt64Vector() {
32  Dispose(false);
33  }
34 
35  public void Dispose() {
36  Dispose(true);
37  global::System.GC.SuppressFinalize(this);
38  }
39 
40  protected virtual void Dispose(bool disposing) {
41  lock(this) {
42  if (swigCPtr.Handle != global::System.IntPtr.Zero) {
43  if (swigCMemOwn) {
44  swigCMemOwn = false;
46  }
47  swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
48  }
49  }
50  }
51 
52  public UtilInt64Vector(global::System.Collections.IEnumerable c) : this() {
53  if (c == null)
54  throw new global::System.ArgumentNullException("c");
55  foreach (long element in c) {
56  this.Add(element);
57  }
58  }
59 
60  public UtilInt64Vector(global::System.Collections.Generic.IEnumerable<long> c) : this() {
61  if (c == null)
62  throw new global::System.ArgumentNullException("c");
63  foreach (long element in c) {
64  this.Add(element);
65  }
66  }
67 
68  public bool IsFixedSize {
69  get {
70  return false;
71  }
72  }
73 
74  public bool IsReadOnly {
75  get {
76  return false;
77  }
78  }
79 
80  public long this[int index] {
81  get {
82  return getitem(index);
83  }
84  set {
85  setitem(index, value);
86  }
87  }
88 
89  public int Capacity {
90  get {
91  return (int)capacity();
92  }
93  set {
94  if (value < size())
95  throw new global::System.ArgumentOutOfRangeException("Capacity");
96  reserve((uint)value);
97  }
98  }
99 
100  public int Count {
101  get {
102  return (int)size();
103  }
104  }
105 
106  public bool IsSynchronized {
107  get {
108  return false;
109  }
110  }
111 
112  public void CopyTo(long[] array)
113  {
114  CopyTo(0, array, 0, this.Count);
115  }
116 
117  public void CopyTo(long[] array, int arrayIndex)
118  {
119  CopyTo(0, array, arrayIndex, this.Count);
120  }
121 
122  public void CopyTo(int index, long[] array, int arrayIndex, int count)
123  {
124  if (array == null)
125  throw new global::System.ArgumentNullException("array");
126  if (index < 0)
127  throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero");
128  if (arrayIndex < 0)
129  throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
130  if (count < 0)
131  throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero");
132  if (array.Rank > 1)
133  throw new global::System.ArgumentException("Multi dimensional array.", "array");
134  if (index+count > this.Count || arrayIndex+count > array.Length)
135  throw new global::System.ArgumentException("Number of elements to copy is too large.");
136  for (int i=0; i<count; i++)
137  array.SetValue(getitemcopy(index+i), arrayIndex+i);
138  }
139 
140  public long[] ToArray() {
141  long[] array = new long[this.Count];
142  this.CopyTo(array);
143  return array;
144  }
145 
146  global::System.Collections.Generic.IEnumerator<long> global::System.Collections.Generic.IEnumerable<long>.GetEnumerator() {
147  return new UtilInt64VectorEnumerator(this);
148  }
149 
150  global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
151  return new UtilInt64VectorEnumerator(this);
152  }
153 
155  return new UtilInt64VectorEnumerator(this);
156  }
157 
158  // Type-safe enumerator
163  public sealed class UtilInt64VectorEnumerator : global::System.Collections.IEnumerator
164  , global::System.Collections.Generic.IEnumerator<long>
165  {
166  private UtilInt64Vector collectionRef;
167  private int currentIndex;
168  private object currentObject;
169  private int currentSize;
170 
172  collectionRef = collection;
173  currentIndex = -1;
174  currentObject = null;
175  currentSize = collectionRef.Count;
176  }
177 
178  // Type-safe iterator Current
179  public long Current {
180  get {
181  if (currentIndex == -1)
182  throw new global::System.InvalidOperationException("Enumeration not started.");
183  if (currentIndex > currentSize - 1)
184  throw new global::System.InvalidOperationException("Enumeration finished.");
185  if (currentObject == null)
186  throw new global::System.InvalidOperationException("Collection modified.");
187  return (long)currentObject;
188  }
189  }
190 
191  // Type-unsafe IEnumerator.Current
192  object global::System.Collections.IEnumerator.Current {
193  get {
194  return Current;
195  }
196  }
197 
198  public bool MoveNext() {
199  int size = collectionRef.Count;
200  bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
201  if (moveOkay) {
202  currentIndex++;
203  currentObject = collectionRef[currentIndex];
204  } else {
205  currentObject = null;
206  }
207  return moveOkay;
208  }
209 
210  public void Reset() {
211  currentIndex = -1;
212  currentObject = null;
213  if (collectionRef.Count != currentSize) {
214  throw new global::System.InvalidOperationException("Collection modified.");
215  }
216  }
217 
218  public void Dispose() {
219  currentIndex = -1;
220  currentObject = null;
221  }
222  }
223 
224  public void Clear() {
226  }
227 
228  public void Add(long x) {
230  }
231 
232  private uint size() {
234  return ret;
235  }
236 
237  private uint capacity() {
238  uint ret = operations_research_utilPINVOKE.UtilInt64Vector_capacity(swigCPtr);
239  return ret;
240  }
241 
242  private void reserve(uint n) {
243  operations_research_utilPINVOKE.UtilInt64Vector_reserve(swigCPtr, n);
244  }
245 
246  public UtilInt64Vector() : this(operations_research_utilPINVOKE.new_UtilInt64Vector__SWIG_0(), true) {
247  }
248 
249  public UtilInt64Vector(UtilInt64Vector other) : this(operations_research_utilPINVOKE.new_UtilInt64Vector__SWIG_1(UtilInt64Vector.getCPtr(other)), true) {
251  }
252 
253  public UtilInt64Vector(int capacity) : this(operations_research_utilPINVOKE.new_UtilInt64Vector__SWIG_2(capacity), true) {
255  }
256 
257  private long getitemcopy(int index) {
260  return ret;
261  }
262 
263  private long getitem(int index) {
264  long ret = operations_research_utilPINVOKE.UtilInt64Vector_getitem(swigCPtr, index);
265  if (operations_research_utilPINVOKE.SWIGPendingException.Pending) throw operations_research_utilPINVOKE.SWIGPendingException.Retrieve();
266  return ret;
267  }
268 
269  private void setitem(int index, long val) {
270  operations_research_utilPINVOKE.UtilInt64Vector_setitem(swigCPtr, index, val);
271  if (operations_research_utilPINVOKE.SWIGPendingException.Pending) throw operations_research_utilPINVOKE.SWIGPendingException.Retrieve();
272  }
273 
274  public void AddRange(UtilInt64Vector values) {
277  }
278 
279  public UtilInt64Vector GetRange(int index, int count) {
280  global::System.IntPtr cPtr = operations_research_utilPINVOKE.UtilInt64Vector_GetRange(swigCPtr, index, count);
281  UtilInt64Vector ret = (cPtr == global::System.IntPtr.Zero) ? null : new UtilInt64Vector(cPtr, true);
283  return ret;
284  }
285 
286  public void Insert(int index, long x) {
289  }
290 
291  public void InsertRange(int index, UtilInt64Vector values) {
294  }
295 
296  public void RemoveAt(int index) {
299  }
300 
301  public void RemoveRange(int index, int count) {
304  }
305 
306  public static UtilInt64Vector Repeat(long value, int count) {
307  global::System.IntPtr cPtr = operations_research_utilPINVOKE.UtilInt64Vector_Repeat(value, count);
308  UtilInt64Vector ret = (cPtr == global::System.IntPtr.Zero) ? null : new UtilInt64Vector(cPtr, true);
310  return ret;
311  }
312 
313  public void Reverse() {
315  }
316 
317  public void Reverse(int index, int count) {
320  }
321 
322  public void SetRange(int index, UtilInt64Vector values) {
325  }
326 
327  public bool Contains(long value) {
328  bool ret = operations_research_utilPINVOKE.UtilInt64Vector_Contains(swigCPtr, value);
329  return ret;
330  }
331 
332  public int IndexOf(long value) {
333  int ret = operations_research_utilPINVOKE.UtilInt64Vector_IndexOf(swigCPtr, value);
334  return ret;
335  }
336 
337  public int LastIndexOf(long value) {
339  return ret;
340  }
341 
342  public bool Remove(long value) {
343  bool ret = operations_research_utilPINVOKE.UtilInt64Vector_Remove(swigCPtr, value);
344  return ret;
345  }
346 
347 }
348 
349 }
Note that the IEnumerator documentation requires an InvalidOperationException to be thrown whenever t...
void Clear()
UtilInt64Vector(int capacity)
void Dispose()
void Reverse()
void Add(long x)
void RemoveAt(int index)
static void UtilInt64Vector_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
int Capacity
UtilInt64VectorEnumerator GetEnumerator()
static int UtilInt64Vector_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void UtilInt64Vector_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
static void UtilInt64Vector_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1)
UtilInt64Vector(UtilInt64Vector other)
UtilInt64VectorEnumerator(UtilInt64Vector collection)
virtual void Dispose(bool disposing)
void SetRange(int index, UtilInt64Vector values)
void CopyTo(int index, long[] array, int arrayIndex, int count)
int IndexOf(long value)
static void UtilInt64Vector_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3)
bool MoveNext()
static UtilInt64Vector Repeat(long value, int count)
bool Contains(long value)
void RemoveRange(int index, int count)
static bool Pending
static void UtilInt64Vector_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, long jarg3)
void Reverse(int index, int count)
bool Remove(long value)
void Reset()
bool IsFixedSize
static void delete_UtilInt64Vector(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr UtilInt64Vector_Repeat(long jarg1, int jarg2)
static int UtilInt64Vector_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void UtilInt64Vector_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
UtilInt64Vector GetRange(int index, int count)
static bool UtilInt64Vector_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
long[] ToArray()
static global::System.Exception Retrieve()
void CopyTo(long[] array)
void CopyTo(long[] array, int arrayIndex)
void AddRange(UtilInt64Vector values)
static void UtilInt64Vector_Add(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
void Insert(int index, long x)
long Current
UtilInt64Vector(global::System.Collections.IEnumerable c)
static bool UtilInt64Vector_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
bool swigCMemOwn
int LastIndexOf(long value)
static void UtilInt64Vector_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
bool IsReadOnly
static void UtilInt64Vector_Clear(global::System.Runtime.InteropServices.HandleRef jarg1)
UtilInt64Vector(global::System.Collections.Generic.IEnumerable< long > c)
void InsertRange(int index, UtilInt64Vector values)
static void UtilInt64Vector_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)
int Count
void Dispose()
Definition: Domain.cs:11
static long UtilInt64Vector_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2)
UtilInt64Vector()
static uint UtilInt64Vector_size(global::System.Runtime.InteropServices.HandleRef jarg1)
bool IsSynchronized
static global::System.IntPtr UtilInt64Vector_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3)