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

package net.openvpn.ovpn3;

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

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

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

  protected static long swigRelease(ClientAPI_LLVector obj) {
    long ptr = 0;
    if (obj != null) {
      if (!obj.swigCMemOwn)
        throw new RuntimeException("Cannot release ownership as memory is not owned");
      ptr = obj.swigCPtr;
      obj.swigCMemOwn = false;
      obj.delete();
    }
    return ptr;
  }

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

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

  public ClientAPI_LLVector(long[] initialElements) {
    this();
    reserve(initialElements.length);

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

  public ClientAPI_LLVector(Iterable<Long> initialElements) {
    this();
    for (long element : initialElements) {
      add(element);
    }
  }

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

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

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

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

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

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

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

  public ClientAPI_LLVector() {
    this(ovpncliJNI.new_ClientAPI_LLVector__SWIG_0(), true);
  }

  public ClientAPI_LLVector(ClientAPI_LLVector other) {
    this(ovpncliJNI.new_ClientAPI_LLVector__SWIG_1(ClientAPI_LLVector.getCPtr(other), other), true);
  }

  public long capacity() {
    return ovpncliJNI.ClientAPI_LLVector_capacity(swigCPtr, this);
  }

  public void reserve(long n) {
    ovpncliJNI.ClientAPI_LLVector_reserve(swigCPtr, this, n);
  }

  public boolean isEmpty() {
    return ovpncliJNI.ClientAPI_LLVector_isEmpty(swigCPtr, this);
  }

  public void clear() {
    ovpncliJNI.ClientAPI_LLVector_clear(swigCPtr, this);
  }

  public ClientAPI_LLVector(int count, long value) {
    this(ovpncliJNI.new_ClientAPI_LLVector__SWIG_2(count, value), true);
  }

  private int doSize() {
    return ovpncliJNI.ClientAPI_LLVector_doSize(swigCPtr, this);
  }

  private void doAdd(long x) {
    ovpncliJNI.ClientAPI_LLVector_doAdd__SWIG_0(swigCPtr, this, x);
  }

  private void doAdd(int index, long x) {
    ovpncliJNI.ClientAPI_LLVector_doAdd__SWIG_1(swigCPtr, this, index, x);
  }

  private long doRemove(int index) {
    return ovpncliJNI.ClientAPI_LLVector_doRemove(swigCPtr, this, index);
  }

  private long doGet(int index) {
    return ovpncliJNI.ClientAPI_LLVector_doGet(swigCPtr, this, index);
  }

  private long doSet(int index, long val) {
    return ovpncliJNI.ClientAPI_LLVector_doSet(swigCPtr, this, index, val);
  }

  private void doRemoveRange(int fromIndex, int toIndex) {
    ovpncliJNI.ClientAPI_LLVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
  }

}
