13public class DoubleVector : global::System.IDisposable, global::System.Collections.IEnumerable, global::System.Collections.Generic.IList<double>
15 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
18 internal DoubleVector(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(
DoubleVector obj) {
24 return (obj ==
null) ?
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero) : obj.swigCPtr;
27 internal static global::System.Runtime.InteropServices.HandleRef swigRelease(
DoubleVector obj) {
30 throw new global::System.ApplicationException(
"Cannot release ownership as memory is not owned");
31 global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
32 obj.swigCMemOwn =
false;
36 return new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
46 global::System.GC.SuppressFinalize(
this);
49 protected virtual void Dispose(
bool disposing) {
51 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
56 swigCPtr =
new global::System.Runtime.InteropServices.HandleRef(
null, global::System.IntPtr.Zero);
61 public DoubleVector(global::System.Collections.IEnumerable c) : this() {
63 throw new global::System.ArgumentNullException(
"c");
64 foreach (
double element
in c) {
69 public DoubleVector(global::System.Collections.Generic.IEnumerable<
double> c) : this() {
71 throw new global::System.ArgumentNullException(
"c");
72 foreach (
double element
in c) {
89 public double this[
int index] {
91 return getitem(index);
94 setitem(index, value);
100 return (
int)capacity();
103 if (value < 0 || (uint)value < size())
104 throw new global::System.ArgumentOutOfRangeException(
"Capacity");
105 reserve((uint)value);
127 public void CopyTo(
double[] array)
132 public void CopyTo(
double[] array,
int arrayIndex)
137 public void CopyTo(
int index,
double[] array,
int arrayIndex,
int count)
140 throw new global::System.ArgumentNullException(
"array");
142 throw new global::System.ArgumentOutOfRangeException(
"index",
"Value is less than zero");
144 throw new global::System.ArgumentOutOfRangeException(
"arrayIndex",
"Value is less than zero");
146 throw new global::System.ArgumentOutOfRangeException(
"count",
"Value is less than zero");
148 throw new global::System.ArgumentException(
"Multi dimensional array.",
"array");
149 if (index+count > this.
Count || arrayIndex+count > array.Length)
150 throw new global::System.ArgumentException(
"Number of elements to copy is too large.");
151 for (
int i=0; i<count; i++)
152 array.SetValue(getitemcopy(index+i), arrayIndex+i);
156 double[] array =
new double[this.
Count];
161 global::System.Collections.Generic.IEnumerator<
double> global::System.Collections.Generic.IEnumerable<
double>.GetEnumerator() {
162 return new DoubleVectorEnumerator(
this);
165 global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() {
166 return new DoubleVectorEnumerator(
this);
169 public DoubleVectorEnumerator GetEnumerator() {
170 return new DoubleVectorEnumerator(
this);
178 public sealed class DoubleVectorEnumerator : global::System.Collections.IEnumerator
179 , global::System.Collections.Generic.IEnumerator<double>
182 private int currentIndex;
183 private object currentObject;
184 private int currentSize;
187 collectionRef = collection;
189 currentObject =
null;
190 currentSize = collectionRef.Count;
196 if (currentIndex == -1)
197 throw new global::System.InvalidOperationException(
"Enumeration not started.");
198 if (currentIndex > currentSize - 1)
199 throw new global::System.InvalidOperationException(
"Enumeration finished.");
200 if (currentObject ==
null)
201 throw new global::System.InvalidOperationException(
"Collection modified.");
202 return (
double)currentObject;
207 object global::System.Collections.IEnumerator.Current {
214 int size = collectionRef.Count;
215 bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
218 currentObject = collectionRef[currentIndex];
220 currentObject =
null;
225 public void Reset() {
227 currentObject =
null;
228 if (collectionRef.Count != currentSize) {
229 throw new global::System.InvalidOperationException(
"Collection modified.");
235 currentObject =
null;
246 public void Clear() {
250 public void Add(
double x) {
254 private uint size() {
259 private bool empty() {
260 bool ret = operations_research_linear_solverPINVOKE.DoubleVector_empty(swigCPtr);
264 private uint capacity() {
265 uint ret = operations_research_linear_solverPINVOKE.DoubleVector_capacity(swigCPtr);
269 private void reserve(uint n) {
270 operations_research_linear_solverPINVOKE.DoubleVector_reserve(swigCPtr, n);
273 public DoubleVector(
int capacity) : this(operations_research_linear_solverPINVOKE.new_DoubleVector__SWIG_2(capacity), true) {
274 if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending)
throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
277 private double getitemcopy(
int index) {
283 private double getitem(
int index) {
284 double ret = operations_research_linear_solverPINVOKE.DoubleVector_getitem(swigCPtr, index);
285 if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending)
throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
289 private void setitem(
int index,
double val) {
290 operations_research_linear_solverPINVOKE.DoubleVector_setitem(swigCPtr, index, val);
291 if (operations_research_linear_solverPINVOKE.SWIGPendingException.Pending)
throw operations_research_linear_solverPINVOKE.SWIGPendingException.Retrieve();
295 operations_research_linear_solverPINVOKE.DoubleVector_AddRange(swigCPtr,
DoubleVector.getCPtr(values));
306 public void Insert(
int index,
double x) {
337 public void Reverse(
int index,
int count) {
347 public bool Contains(
double value) {
352 public int IndexOf(
double value) {
362 public bool Remove(
double value) {