14using System.Runtime.InteropServices;
15using System.Collections;
17public partial class Int64Vector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<long>
22 internal Int64Vector(global::System.IntPtr cPtr,
bool cMemoryOwn) {
24 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
this, cPtr);
27 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(
Int64Vector obj) {
28 return (obj ==
null) ?
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero) : obj.swigCPtr;
31 internal static global::System.Runtime.InteropServices.HandleRef swigRelease(
Int64Vector obj) {
34 throw new global::System.ApplicationException(
"Cannot release ownership as memory is not owned");
35 global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
36 obj.swigCMemOwn =
false;
40 return new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
50 global::System.GC.SuppressFinalize(
this);
53 protected virtual void Dispose(
bool disposing) {
55 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
60 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
65 public Int64Vector(global::System.Collections.IEnumerable c) : this() {
67 throw new global::System.ArgumentNullException(
"c");
68 foreach (
long element
in c) {
73 public Int64Vector(global::System.Collections.Generic.IEnumerable<
long> c) : this() {
75 throw new global::System.ArgumentNullException(
"c");
76 foreach (
long element
in c) {
93 public long this[
int index] {
95 return getitem(index);
98 setitem(index, value);
104 return (
int)capacity();
107 if (value < 0 || (uint)value < size())
108 throw new global::System.ArgumentOutOfRangeException(
"Capacity");
109 reserve((uint)value);
131 public void CopyTo(
long[] array)
136 public void CopyTo(
long[] array,
int arrayIndex)
141 public void CopyTo(
int index,
long[] array,
int arrayIndex,
int count)
144 throw new global::System.ArgumentNullException(
"array");
146 throw new global::System.ArgumentOutOfRangeException(
"index",
"Value is less than zero");
148 throw new global::System.ArgumentOutOfRangeException(
"arrayIndex",
"Value is less than zero");
150 throw new global::System.ArgumentOutOfRangeException(
"count",
"Value is less than zero");
152 throw new global::System.ArgumentException(
"Multi dimensional array.",
"array");
153 if (index+count > this.
Count || arrayIndex+count > array.Length)
154 throw new global::System.ArgumentException(
"Number of elements to copy is too large.");
155 for (
int i=0; i<count; i++)
156 array.SetValue(getitemcopy(index+i), arrayIndex+i);
160 long[] array =
new long[this.
Count];
165 global::System.Collections.Generic.IEnumerator<
long> global::System.Collections.Generic.IEnumerable<
long>.GetEnumerator() {
166 return new Int64VectorEnumerator(
this);
169 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
170 return new Int64VectorEnumerator(
this);
173 public Int64VectorEnumerator GetEnumerator() {
174 return new Int64VectorEnumerator(
this);
182 public sealed class Int64VectorEnumerator : global::System.Collections.IEnumerator
183 , global::System.Collections.Generic.IEnumerator<long>
186 private int currentIndex;
187 private object currentObject;
188 private int currentSize;
191 collectionRef = collection;
193 currentObject =
null;
194 currentSize = collectionRef.Count;
200 if (currentIndex == -1)
201 throw new global::System.InvalidOperationException(
"Enumeration not started.");
202 if (currentIndex > currentSize - 1)
203 throw new global::System.InvalidOperationException(
"Enumeration finished.");
204 if (currentObject ==
null)
205 throw new global::System.InvalidOperationException(
"Collection modified.");
206 return (
long)currentObject;
211 object global::System.Collections.IEnumerator.Current {
218 int size = collectionRef.Count;
219 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
222 currentObject = collectionRef[currentIndex];
224 currentObject =
null;
229 public void Reset() {
231 currentObject =
null;
232 if (collectionRef.Count != currentSize) {
233 throw new global::System.InvalidOperationException(
"Collection modified.");
239 currentObject =
null;
250 public void Clear() {
254 public void Add(
long x) {
258 private uint size() {
263 private bool empty() {
264 bool ret = operations_research_utilPINVOKE.Int64Vector_empty(swigCPtr);
268 private uint capacity() {
269 uint ret = operations_research_utilPINVOKE.Int64Vector_capacity(swigCPtr);
273 private void reserve(uint n) {
274 operations_research_utilPINVOKE.Int64Vector_reserve(swigCPtr, n);
277 public Int64Vector(
int capacity) : this(operations_research_utilPINVOKE.new_Int64Vector__SWIG_2(capacity), true) {
278 if (operations_research_utilPINVOKE.SWIGPendingException.Pending)
throw operations_research_utilPINVOKE.SWIGPendingException.Retrieve();
281 private long getitemcopy(
int index) {
287 private long getitem(
int index) {
288 long ret = operations_research_utilPINVOKE.Int64Vector_getitem(swigCPtr, index);
289 if (operations_research_utilPINVOKE.SWIGPendingException.Pending)
throw operations_research_utilPINVOKE.SWIGPendingException.Retrieve();
293 private void setitem(
int index,
long val) {
294 operations_research_utilPINVOKE.Int64Vector_setitem(swigCPtr, index, val);
295 if (operations_research_utilPINVOKE.SWIGPendingException.Pending)
throw operations_research_utilPINVOKE.SWIGPendingException.Retrieve();
299 operations_research_utilPINVOKE.Int64Vector_AddRange(swigCPtr,
Int64Vector.getCPtr(values));
310 public void Insert(
int index,
long x) {
341 public void Reverse(
int index,
int count) {
356 public int IndexOf(
long value) {
366 public bool Remove(
long value) {