14using System.Runtime.InteropServices;
15using System.Collections;
16using System.Collections.Generic;
18public partial class IntVarVector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<IntVar>
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;
32 internal static global::System.Runtime.InteropServices.HandleRef swigRelease(
IntVarVector obj) {
35 throw new global::System.ApplicationException(
"Cannot release ownership as memory is not owned");
36 global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
37 obj.swigCMemOwn =
false;
41 return new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
51 global::System.GC.SuppressFinalize(
this);
54 protected virtual void Dispose(
bool disposing) {
56 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
61 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
66 public IntVarVector(global::System.Collections.IEnumerable c) : this() {
68 throw new global::System.ArgumentNullException(
"c");
69 foreach (
IntVar element
in c) {
74 public IntVarVector(global::System.Collections.Generic.IEnumerable<IntVar> c) : this() {
76 throw new global::System.ArgumentNullException(
"c");
77 foreach (
IntVar element
in c) {
94 public IntVar
this[
int index] {
96 return getitem(index);
99 setitem(index, value);
105 return (
int)capacity();
108 if (value < 0 || (uint)value < size())
109 throw new global::System.ArgumentOutOfRangeException(
"Capacity");
110 reserve((uint)value);
132 public void CopyTo(IntVar[] array)
142 public void CopyTo(
int index,
IntVar[] array,
int arrayIndex,
int count)
145 throw new global::System.ArgumentNullException(
"array");
147 throw new global::System.ArgumentOutOfRangeException(
"index",
"Value is less than zero");
149 throw new global::System.ArgumentOutOfRangeException(
"arrayIndex",
"Value is less than zero");
151 throw new global::System.ArgumentOutOfRangeException(
"count",
"Value is less than zero");
153 throw new global::System.ArgumentException(
"Multi dimensional array.",
"array");
154 if (index+count > this.
Count || arrayIndex+count > array.Length)
155 throw new global::System.ArgumentException(
"Number of elements to copy is too large.");
156 for (
int i=0; i<count; i++)
157 array.
SetValue(getitemcopy(index+i), arrayIndex+i);
166 global::System.Collections.Generic.IEnumerator<
IntVar> global::System.Collections.Generic.IEnumerable<
IntVar>.GetEnumerator() {
167 return new IntVarVectorEnumerator(
this);
170 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
171 return new IntVarVectorEnumerator(
this);
174 public IntVarVectorEnumerator GetEnumerator() {
175 return new IntVarVectorEnumerator(
this);
183 public sealed class IntVarVectorEnumerator : global::System.Collections.IEnumerator
184 , global::System.Collections.Generic.IEnumerator<IntVar>
187 private int currentIndex;
188 private object currentObject;
189 private int currentSize;
192 collectionRef = collection;
194 currentObject =
null;
195 currentSize = collectionRef.Count;
201 if (currentIndex == -1)
202 throw new global::System.InvalidOperationException(
"Enumeration not started.");
203 if (currentIndex > currentSize - 1)
204 throw new global::System.InvalidOperationException(
"Enumeration finished.");
205 if (currentObject ==
null)
206 throw new global::System.InvalidOperationException(
"Collection modified.");
207 return (
IntVar)currentObject;
212 object global::System.Collections.IEnumerator.Current {
219 int size = collectionRef.Count;
220 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
223 currentObject = collectionRef[currentIndex];
225 currentObject =
null;
230 public void Reset() {
232 currentObject =
null;
233 if (collectionRef.Count != currentSize) {
234 throw new global::System.InvalidOperationException(
"Collection modified.");
240 currentObject =
null;
251 public void Clear() {
259 private uint size() {
264 private bool empty() {
265 bool ret = operations_research_constraint_solverPINVOKE.IntVarVector_empty(swigCPtr);
269 private uint capacity() {
270 uint ret = operations_research_constraint_solverPINVOKE.IntVarVector_capacity(swigCPtr);
274 private void reserve(uint n) {
275 operations_research_constraint_solverPINVOKE.IntVarVector_reserve(swigCPtr, n);
278 public IntVarVector(
int capacity) : this(operations_research_constraint_solverPINVOKE.new_IntVarVector__SWIG_2(capacity), true) {
279 if (operations_research_constraint_solverPINVOKE.SWIGPendingException.Pending)
throw operations_research_constraint_solverPINVOKE.SWIGPendingException.Retrieve();
282 private IntVar getitemcopy(
int index) {
284 IntVar ret = (cPtr == global::System.IntPtr.Zero) ?
null :
new IntVar(cPtr,
false);
289 private IntVar getitem(
int index) {
290 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVarVector_getitem(swigCPtr, index);
291 IntVar ret = (cPtr == global::System.IntPtr.Zero) ?
null : new IntVar(cPtr, false);
292 if (operations_research_constraint_solverPINVOKE.SWIGPendingException.Pending)
throw operations_research_constraint_solverPINVOKE.SWIGPendingException.Retrieve();
296 private void setitem(
int index, IntVar val) {
297 operations_research_constraint_solverPINVOKE.IntVarVector_setitem(swigCPtr, index, IntVar.getCPtr(val));
298 if (operations_research_constraint_solverPINVOKE.SWIGPendingException.Pending)
throw operations_research_constraint_solverPINVOKE.SWIGPendingException.Retrieve();
302 operations_research_constraint_solverPINVOKE.IntVarVector_AddRange(swigCPtr,
IntVarVector.getCPtr(values));
344 public void Reverse(
int index,
int count) {