13 public class KInt64Vector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<long>
15 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
18 internal KInt64Vector(global::System.IntPtr cPtr,
bool cMemoryOwn) {
20 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
this, cPtr);
23 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(
KInt64Vector obj) {
24 return (obj ==
null) ?
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero) : obj.swigCPtr;
33 global::System.GC.SuppressFinalize(
this);
36 protected virtual void Dispose(
bool disposing) {
38 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
43 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
48 public KInt64Vector(global::System.Collections.IEnumerable c) : this() {
50 throw new global::System.ArgumentNullException(
"c");
51 foreach (
long element
in c) {
56 public KInt64Vector(global::System.Collections.Generic.IEnumerable<
long> c) : this() {
58 throw new global::System.ArgumentNullException(
"c");
59 foreach (
long element
in c) {
76 public long this[
int index] {
78 return getitem(index);
81 setitem(index, value);
87 return (
int)capacity();
91 throw new global::System.ArgumentOutOfRangeException(
"Capacity");
113 public void CopyTo(
long[] array,
int arrayIndex)
118 public void CopyTo(
int index,
long[] array,
int arrayIndex,
int count)
121 throw new global::System.ArgumentNullException(
"array");
123 throw new global::System.ArgumentOutOfRangeException(
"index",
"Value is less than zero");
125 throw new global::System.ArgumentOutOfRangeException(
"arrayIndex",
"Value is less than zero");
127 throw new global::System.ArgumentOutOfRangeException(
"count",
"Value is less than zero");
129 throw new global::System.ArgumentException(
"Multi dimensional array.",
"array");
130 if (index+count > this.
Count || arrayIndex+count > array.Length)
131 throw new global::System.ArgumentException(
"Number of elements to copy is too large.");
132 for (
int i=0; i<count; i++)
133 array.SetValue(getitemcopy(index+i), arrayIndex+i);
137 long[] array =
new long[this.
Count];
142 global::System.Collections.Generic.IEnumerator<
long> global::System.Collections.Generic.IEnumerable<
long>.GetEnumerator() {
143 return new KInt64VectorEnumerator(
this);
146 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
147 return new KInt64VectorEnumerator(
this);
160 , global::System.Collections.Generic.IEnumerator<long>
163 private int currentIndex;
164 private object currentObject;
165 private int currentSize;
168 collectionRef = collection;
170 currentObject =
null;
171 currentSize = collectionRef.
Count;
177 if (currentIndex == -1)
178 throw new global::System.InvalidOperationException(
"Enumeration not started.");
179 if (currentIndex > currentSize - 1)
180 throw new global::System.InvalidOperationException(
"Enumeration finished.");
181 if (currentObject ==
null)
182 throw new global::System.InvalidOperationException(
"Collection modified.");
183 return (
long)currentObject;
188 object global::System.Collections.IEnumerator.Current {
195 int size = collectionRef.Count;
196 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
199 currentObject = collectionRef[currentIndex];
201 currentObject =
null;
208 currentObject =
null;
209 if (collectionRef.Count != currentSize) {
210 throw new global::System.InvalidOperationException(
"Collection modified.");
216 currentObject =
null;
228 private uint size() {
233 private uint capacity() {
234 uint ret = operations_research_algorithmsPINVOKE.KInt64Vector_capacity(swigCPtr);
238 private void reserve(uint n) {
239 operations_research_algorithmsPINVOKE.KInt64Vector_reserve(swigCPtr, n);
253 private long getitemcopy(
int index) {
259 private long getitem(
int index) {
260 long ret = operations_research_algorithmsPINVOKE.KInt64Vector_getitem(swigCPtr, index);
261 if (operations_research_algorithmsPINVOKE.SWIGPendingException.Pending)
throw operations_research_algorithmsPINVOKE.SWIGPendingException.Retrieve();
265 private void setitem(
int index,
long val) {
266 operations_research_algorithmsPINVOKE.KInt64Vector_setitem(swigCPtr, index, val);
267 if (operations_research_algorithmsPINVOKE.SWIGPendingException.Pending)
throw operations_research_algorithmsPINVOKE.SWIGPendingException.Retrieve();