/* ----------------------------------------------------------------------------
 * 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 CmsCouponPricerVector extends java.util.AbstractList<CmsCouponPricer> implements java.util.RandomAccess {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

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

  protected static long getCPtr(CmsCouponPricerVector 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_CmsCouponPricerVector(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CmsCouponPricerVector(CmsCouponPricer[] initialElements) {
    this();
    reserve(initialElements.length);

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

  public CmsCouponPricerVector(Iterable<CmsCouponPricer> initialElements) {
    this();
    for (CmsCouponPricer element : initialElements) {
      add(element);
    }
  }

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

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

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

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

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

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

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

  public CmsCouponPricerVector() {
    this(QuantLibJNI.new_CmsCouponPricerVector__SWIG_0(), true);
  }

  public CmsCouponPricerVector(CmsCouponPricerVector other) {
    this(QuantLibJNI.new_CmsCouponPricerVector__SWIG_1(CmsCouponPricerVector.getCPtr(other), other), true);
  }

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

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

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

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

  public CmsCouponPricerVector(int count, CmsCouponPricer value) {
    this(QuantLibJNI.new_CmsCouponPricerVector__SWIG_2(count, CmsCouponPricer.getCPtr(value), value), true);
  }

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

  private void doAdd(CmsCouponPricer x) {
    QuantLibJNI.CmsCouponPricerVector_doAdd__SWIG_0(swigCPtr, this, CmsCouponPricer.getCPtr(x), x);
  }

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

  private CmsCouponPricer doRemove(int index) {
    long cPtr = QuantLibJNI.CmsCouponPricerVector_doRemove(swigCPtr, this, index);
    return (cPtr == 0) ? null : new CmsCouponPricer(cPtr, true);
  }

  private CmsCouponPricer doGet(int index) {
    long cPtr = QuantLibJNI.CmsCouponPricerVector_doGet(swigCPtr, this, index);
    return (cPtr == 0) ? null : new CmsCouponPricer(cPtr, true);
  }

  private CmsCouponPricer doSet(int index, CmsCouponPricer val) {
    long cPtr = QuantLibJNI.CmsCouponPricerVector_doSet(swigCPtr, this, index, CmsCouponPricer.getCPtr(val), val);
    return (cPtr == 0) ? null : new CmsCouponPricer(cPtr, true);
  }

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

}
