15 using System.Collections;
17 public class UtilInt64Vector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<long>
19 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
24 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
this, cPtr);
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;
37 global::System.GC.SuppressFinalize(
this);
40 protected virtual void Dispose(
bool disposing) {
42 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
47 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
54 throw new global::System.ArgumentNullException(
"c");
55 foreach (
long element
in c) {
60 public UtilInt64Vector(global::System.Collections.Generic.IEnumerable<
long> c) : this() {
62 throw new global::System.ArgumentNullException(
"c");
63 foreach (
long element
in c) {
80 public long this[
int index] {
82 return getitem(index);
85 setitem(index, value);
91 return (
int)capacity();
95 throw new global::System.ArgumentOutOfRangeException(
"Capacity");
117 public void CopyTo(
long[] array,
int arrayIndex)
122 public void CopyTo(
int index,
long[] array,
int arrayIndex,
int count)
125 throw new global::System.ArgumentNullException(
"array");
127 throw new global::System.ArgumentOutOfRangeException(
"index",
"Value is less than zero");
129 throw new global::System.ArgumentOutOfRangeException(
"arrayIndex",
"Value is less than zero");
131 throw new global::System.ArgumentOutOfRangeException(
"count",
"Value is less than zero");
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);
141 long[] array =
new long[this.
Count];
146 global::System.Collections.Generic.IEnumerator<
long> global::System.Collections.Generic.IEnumerable<
long>.GetEnumerator() {
147 return new UtilInt64VectorEnumerator(
this);
150 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
151 return new UtilInt64VectorEnumerator(
this);
164 , global::System.Collections.Generic.IEnumerator<long>
167 private int currentIndex;
168 private object currentObject;
169 private int currentSize;
172 collectionRef = collection;
174 currentObject =
null;
175 currentSize = collectionRef.
Count;
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;
192 object global::System.Collections.IEnumerator.Current {
199 int size = collectionRef.Count;
200 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
203 currentObject = collectionRef[currentIndex];
205 currentObject =
null;
212 currentObject =
null;
213 if (collectionRef.Count != currentSize) {
214 throw new global::System.InvalidOperationException(
"Collection modified.");
220 currentObject =
null;
232 private uint size() {
237 private uint capacity() {
238 uint ret = operations_research_utilPINVOKE.UtilInt64Vector_capacity(swigCPtr);
242 private void reserve(uint n) {
243 operations_research_utilPINVOKE.UtilInt64Vector_reserve(swigCPtr, n);
257 private long getitemcopy(
int index) {
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();
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();