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

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

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

  protected static long swigRelease(ClientAPI_StringVec 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_StringVec(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public ClientAPI_StringVec(String[] initialElements) {
    this();
    reserve(initialElements.length);

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

  public ClientAPI_StringVec(Iterable<String> initialElements) {
    this();
    for (String element : initialElements) {
      add(element);
    }
  }

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

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

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

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

  public String 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_StringVec() {
    this(ovpncliJNI.new_ClientAPI_StringVec__SWIG_0(), true);
  }

  public ClientAPI_StringVec(ClientAPI_StringVec other) {
    this(ovpncliJNI.new_ClientAPI_StringVec__SWIG_1(ClientAPI_StringVec.getCPtr(other), other), true);
  }

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

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

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

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

  public ClientAPI_StringVec(int count, String value) {
    this(ovpncliJNI.new_ClientAPI_StringVec__SWIG_2(count, value), true);
  }

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

  private void doAdd(String x) {
    ovpncliJNI.ClientAPI_StringVec_doAdd__SWIG_0(swigCPtr, this, x);
  }

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

  private String doRemove(int index) {
    return ovpncliJNI.ClientAPI_StringVec_doRemove(swigCPtr, this, index);
  }

  private String doGet(int index) {
    return ovpncliJNI.ClientAPI_StringVec_doGet(swigCPtr, this, index);
  }

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

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

}
