15 using System.Collections;
16 using System.Collections.Generic;
18 public partial class IntVarVector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<IntVar>
20 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23 internal IntVarVector(global::System.IntPtr cPtr,
bool cMemoryOwn) {
25 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
this, cPtr);
28 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(
IntVarVector obj) {
29 return (obj ==
null) ?
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero) : obj.swigCPtr;
38 global::System.GC.SuppressFinalize(
this);
41 protected virtual void Dispose(
bool disposing) {
43 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
48 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
53 public IntVarVector(global::System.Collections.IEnumerable c) : this() {
55 throw new global::System.ArgumentNullException(
"c");
56 foreach (
IntVar element
in c) {
63 throw new global::System.ArgumentNullException(
"c");
64 foreach (
IntVar element
in c) {
83 return getitem(index);
86 setitem(index, value);
92 return (
int)capacity();
96 throw new global::System.ArgumentOutOfRangeException(
"Capacity");
123 public void CopyTo(
int index,
IntVar[] array,
int arrayIndex,
int count)
126 throw new global::System.ArgumentNullException(
"array");
128 throw new global::System.ArgumentOutOfRangeException(
"index",
"Value is less than zero");
130 throw new global::System.ArgumentOutOfRangeException(
"arrayIndex",
"Value is less than zero");
132 throw new global::System.ArgumentOutOfRangeException(
"count",
"Value is less than zero");
134 throw new global::System.ArgumentException(
"Multi dimensional array.",
"array");
135 if (index+count > this.
Count || arrayIndex+count > array.Length)
136 throw new global::System.ArgumentException(
"Number of elements to copy is too large.");
137 for (
int i=0; i<count; i++)
138 array.
SetValue(getitemcopy(index+i), arrayIndex+i);
147 global::System.Collections.Generic.IEnumerator<
IntVar> global::System.Collections.Generic.IEnumerable<
IntVar>.GetEnumerator() {
148 return new IntVarVectorEnumerator(
this);
151 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
152 return new IntVarVectorEnumerator(
this);
165 , global::System.Collections.Generic.IEnumerator<IntVar>
168 private int currentIndex;
169 private object currentObject;
170 private int currentSize;
173 collectionRef = collection;
175 currentObject =
null;
176 currentSize = collectionRef.
Count;
182 if (currentIndex == -1)
183 throw new global::System.InvalidOperationException(
"Enumeration not started.");
184 if (currentIndex > currentSize - 1)
185 throw new global::System.InvalidOperationException(
"Enumeration finished.");
186 if (currentObject ==
null)
187 throw new global::System.InvalidOperationException(
"Collection modified.");
188 return (
IntVar)currentObject;
193 object global::System.Collections.IEnumerator.Current {
200 int size = collectionRef.Count;
201 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
204 currentObject = collectionRef[currentIndex];
206 currentObject =
null;
213 currentObject =
null;
214 if (collectionRef.Count != currentSize) {
215 throw new global::System.InvalidOperationException(
"Collection modified.");
221 currentObject =
null;
233 private uint size() {
238 private uint capacity() {
239 uint ret = operations_research_constraint_solverPINVOKE.IntVarVector_capacity(swigCPtr);
243 private void reserve(uint n) {
244 operations_research_constraint_solverPINVOKE.IntVarVector_reserve(swigCPtr, n);
258 private IntVar getitemcopy(
int index) {
260 IntVar ret = (cPtr == global::System.IntPtr.Zero) ?
null :
new IntVar(cPtr,
false);
265 private IntVar getitem(
int index) {
266 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVarVector_getitem(swigCPtr, index);
267 IntVar ret = (cPtr == global::System.IntPtr.Zero) ?
null :
new IntVar(cPtr,
false);
268 if (operations_research_constraint_solverPINVOKE.SWIGPendingException.Pending)
throw operations_research_constraint_solverPINVOKE.SWIGPendingException.Retrieve();
272 private void setitem(
int index, IntVar val) {
273 operations_research_constraint_solverPINVOKE.IntVarVector_setitem(swigCPtr, index, IntVar.getCPtr(val));
274 if (operations_research_constraint_solverPINVOKE.SWIGPendingException.Pending)
throw operations_research_constraint_solverPINVOKE.SWIGPendingException.Retrieve();