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

package org.quantlib;

public class RelinkableQuoteHandleVector extends java.util.AbstractList<RelinkableQuoteHandle> implements java.util.RandomAccess {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected RelinkableQuoteHandleVector(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(RelinkableQuoteHandleVector obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        QuantLibJNI.delete_RelinkableQuoteHandleVector(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public RelinkableQuoteHandleVector(RelinkableQuoteHandle[] initialElements) {
    this();
    reserve(initialElements.length);

    for (RelinkableQuoteHandle element : initialElements) {
      add(element);
    }
  }

  public RelinkableQuoteHandleVector(Iterable<RelinkableQuoteHandle> initialElements) {
    this();
    for (RelinkableQuoteHandle element : initialElements) {
      add(element);
    }
  }

  public RelinkableQuoteHandle get(int index) {
    return doGet(index);
  }

  public RelinkableQuoteHandle set(int index, RelinkableQuoteHandle e) {
    return doSet(index, e);
  }

  public boolean add(RelinkableQuoteHandle e) {
    modCount++;
    doAdd(e);
    return true;
  }

  public void add(int index, RelinkableQuoteHandle e) {
    modCount++;
    doAdd(index, e);
  }

  public RelinkableQuoteHandle remove(int index) {
    modCount++;
    return doRemove(index);
  }

  protected void removeRange(int fromIndex, int toIndex) {
    modCount++;
    doRemoveRange(fromIndex, toIndex);
  }

  public int size() {
    return doSize();
  }

  public RelinkableQuoteHandleVector() {
    this(QuantLibJNI.new_RelinkableQuoteHandleVector__SWIG_0(), true);
  }

  public RelinkableQuoteHandleVector(RelinkableQuoteHandleVector other) {
    this(QuantLibJNI.new_RelinkableQuoteHandleVector__SWIG_1(RelinkableQuoteHandleVector.getCPtr(other), other), true);
  }

  public long capacity() {
    return QuantLibJNI.RelinkableQuoteHandleVector_capacity(swigCPtr, this);
  }

  public void reserve(long n) {
    QuantLibJNI.RelinkableQuoteHandleVector_reserve(swigCPtr, this, n);
  }

  public boolean isEmpty() {
    return QuantLibJNI.RelinkableQuoteHandleVector_isEmpty(swigCPtr, this);
  }

  public void clear() {
    QuantLibJNI.RelinkableQuoteHandleVector_clear(swigCPtr, this);
  }

  public RelinkableQuoteHandleVector(int count, RelinkableQuoteHandle value) {
    this(QuantLibJNI.new_RelinkableQuoteHandleVector__SWIG_2(count, RelinkableQuoteHandle.getCPtr(value), value), true);
  }

  private int doSize() {
    return QuantLibJNI.RelinkableQuoteHandleVector_doSize(swigCPtr, this);
  }

  private void doAdd(RelinkableQuoteHandle x) {
    QuantLibJNI.RelinkableQuoteHandleVector_doAdd__SWIG_0(swigCPtr, this, RelinkableQuoteHandle.getCPtr(x), x);
  }

  private void doAdd(int index, RelinkableQuoteHandle x) {
    QuantLibJNI.RelinkableQuoteHandleVector_doAdd__SWIG_1(swigCPtr, this, index, RelinkableQuoteHandle.getCPtr(x), x);
  }

  private RelinkableQuoteHandle doRemove(int index) {
    return new RelinkableQuoteHandle(QuantLibJNI.RelinkableQuoteHandleVector_doRemove(swigCPtr, this, index), true);
  }

  private RelinkableQuoteHandle doGet(int index) {
    return new RelinkableQuoteHandle(QuantLibJNI.RelinkableQuoteHandleVector_doGet(swigCPtr, this, index), false);
  }

  private RelinkableQuoteHandle doSet(int index, RelinkableQuoteHandle val) {
    return new RelinkableQuoteHandle(QuantLibJNI.RelinkableQuoteHandleVector_doSet(swigCPtr, this, index, RelinkableQuoteHandle.getCPtr(val), val), true);
  }

  private void doRemoveRange(int fromIndex, int toIndex) {
    QuantLibJNI.RelinkableQuoteHandleVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
  }

}
