/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.36
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */


using System;
using System.Runtime.InteropServices;

public class vVector3 : IDisposable, System.Collections.IEnumerable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal vVector3(IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(vVector3 obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~vVector3() {
    Dispose();
  }

  public virtual void Dispose() {
    lock(this) {
      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
        swigCMemOwn = false;
        openbabelPINVOKE.delete_vVector3(swigCPtr);
      }
      swigCPtr = new HandleRef(null, IntPtr.Zero);
      GC.SuppressFinalize(this);
    }
  }

  public vVector3(System.Collections.ICollection c) : this() {
    if (c == null)
      throw new ArgumentNullException("c");
    foreach (vector3 element in c) {
      this.Add(element);
    }
  }

  public bool IsFixedSize {
    get {
      return false;
    }
  }

  public bool IsReadOnly {
    get {
      return false;
    }
  }

  public vector3 this[int index]  {
    get {
      return getitem(index);
    }
    set {
      setitem(index, value);
    }
  }

  public int Capacity {
    get {
      return (int)capacity();
    }
    set {
      if (value < size())
        throw new ArgumentOutOfRangeException("Capacity");
      reserve((uint)value);
    }
  }

  public int Count {
    get {
      return (int)size();
    }
  }

  public bool IsSynchronized {
    get {
      return false;
    }
  }

  public void CopyTo(System.Array array) {
    CopyTo(0, array, 0, this.Count);
  }

  public void CopyTo(System.Array array, int arrayIndex) {
    CopyTo(0, array, arrayIndex, this.Count);
  }

  public void CopyTo(int index, System.Array array, int arrayIndex, int count) {
    if (array == null)
      throw new ArgumentNullException("array");
    if (index < 0)
      throw new ArgumentOutOfRangeException("index", "Value is less than zero");
    if (arrayIndex < 0)
      throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
    if (count < 0)
      throw new ArgumentOutOfRangeException("count", "Value is less than zero");
    if (array.Rank > 1)
      throw new ArgumentException("Multi dimensional array.");
    if (index+count > this.Count || arrayIndex+count > array.Length)
      throw new ArgumentException("Number of elements to copy is too large.");
    for (int i=0; i<count; i++)
      array.SetValue(getitemcopy(index+i), arrayIndex+i);
  }

  // Type-safe version of IEnumerable.GetEnumerator
  System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
    return new vVector3Enumerator(this);
  }

  public vVector3Enumerator GetEnumerator() {
    return new vVector3Enumerator(this);
  }

  // Type-safe enumerator
  /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
  /// whenever the collection is modified. This has been done for changes in the size of the
  /// collection but not when one of the elements of the collection is modified as it is a bit
  /// tricky to detect unmanaged code that modifies the collection under our feet.
  public sealed class vVector3Enumerator : System.Collections.IEnumerator {
    private vVector3 collectionRef;
    private int currentIndex;
    private object currentObject;
    private int currentSize;

    public vVector3Enumerator(vVector3 collection) {
      collectionRef = collection;
      currentIndex = -1;
      currentObject = null;
      currentSize = collectionRef.Count;
    }

    // Type-safe iterator Current
    public vector3 Current {
      get {
        if (currentIndex == -1)
          throw new InvalidOperationException("Enumeration not started.");
        if (currentIndex > currentSize - 1)
          throw new InvalidOperationException("Enumeration finished.");
        if (currentObject == null)
          throw new InvalidOperationException("Collection modified.");
        return (vector3)currentObject;
      }
    }

    // Type-unsafe IEnumerator.Current
    object System.Collections.IEnumerator.Current {
      get {
        return Current;
      }
    }

    public bool MoveNext() {
      int size = collectionRef.Count;
      bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
      if (moveOkay) {
        currentIndex++;
        currentObject = collectionRef[currentIndex];
      } else {
        currentObject = null;
      }
      return moveOkay;
    }

    public void Reset() {
      currentIndex = -1;
      currentObject = null;
      if (collectionRef.Count != currentSize) {
        throw new InvalidOperationException("Collection modified.");
      }
    }
  }

  public void Clear() {
    openbabelPINVOKE.vVector3_Clear(swigCPtr);
  }

  public void Add(vector3 x) {
    openbabelPINVOKE.vVector3_Add(swigCPtr, vector3.getCPtr(x));
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

  private uint size() {
    uint ret = openbabelPINVOKE.vVector3_size(swigCPtr);
    return ret;
  }

  private uint capacity() {
    uint ret = openbabelPINVOKE.vVector3_capacity(swigCPtr);
    return ret;
  }

  private void reserve(uint n) {
    openbabelPINVOKE.vVector3_reserve(swigCPtr, n);
  }

  public vVector3() : this(openbabelPINVOKE.new_vVector3__SWIG_0(), true) {
  }

  public vVector3(int capacity) : this(openbabelPINVOKE.new_vVector3__SWIG_1(capacity), true) {
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

  private vector3 getitemcopy(int index) {
    vector3 ret = new vector3(openbabelPINVOKE.vVector3_getitemcopy(swigCPtr, index), true);
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  private vector3 getitem(int index) {
    vector3 ret = new vector3(openbabelPINVOKE.vVector3_getitem(swigCPtr, index), false);
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  private void setitem(int index, vector3 val) {
    openbabelPINVOKE.vVector3_setitem(swigCPtr, index, vector3.getCPtr(val));
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

  public void AddRange(vVector3 values) {
    openbabelPINVOKE.vVector3_AddRange(swigCPtr, vVector3.getCPtr(values));
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

  public vVector3 GetRange(int index, int count) {
    IntPtr cPtr = openbabelPINVOKE.vVector3_GetRange(swigCPtr, index, count);
    vVector3 ret = (cPtr == IntPtr.Zero) ? null : new vVector3(cPtr, true);
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void Insert(int index, vector3 x) {
    openbabelPINVOKE.vVector3_Insert(swigCPtr, index, vector3.getCPtr(x));
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

  public void InsertRange(int index, vVector3 values) {
    openbabelPINVOKE.vVector3_InsertRange(swigCPtr, index, vVector3.getCPtr(values));
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

  public void RemoveAt(int index) {
    openbabelPINVOKE.vVector3_RemoveAt(swigCPtr, index);
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

  public void RemoveRange(int index, int count) {
    openbabelPINVOKE.vVector3_RemoveRange(swigCPtr, index, count);
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

  public static vVector3 Repeat(vector3 value, int count) {
    IntPtr cPtr = openbabelPINVOKE.vVector3_Repeat(vector3.getCPtr(value), count);
    vVector3 ret = (cPtr == IntPtr.Zero) ? null : new vVector3(cPtr, true);
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void Reverse() {
    openbabelPINVOKE.vVector3_Reverse__SWIG_0(swigCPtr);
  }

  public void Reverse(int index, int count) {
    openbabelPINVOKE.vVector3_Reverse__SWIG_1(swigCPtr, index, count);
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

  public void SetRange(int index, vVector3 values) {
    openbabelPINVOKE.vVector3_SetRange(swigCPtr, index, vVector3.getCPtr(values));
    if (openbabelPINVOKE.SWIGPendingException.Pending) throw openbabelPINVOKE.SWIGPendingException.Retrieve();
  }

}
