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

package com.robotraconteur;

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

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

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

  protected static long swigRelease(vectorptr_exceptiondefinition 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", "removal"})
  protected void finalize() {
    delete();
  }

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

  @SuppressWarnings("this-escape")
  public vectorptr_exceptiondefinition(ExceptionDefinition[] initialElements) {
    this();
    doReserve(initialElements.length);

    for (ExceptionDefinition element : initialElements) {
      doAdd(element);
    }
  }

  @SuppressWarnings("this-escape")
  public vectorptr_exceptiondefinition(Iterable<ExceptionDefinition> initialElements) {
    this();
    for (ExceptionDefinition element : initialElements) {
      doAdd(element);
    }
  }

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

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

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

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

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

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

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

  public int capacity() {
    return doCapacity();
  }

  public void reserve(int n) {
    doReserve(n);
  }

  public vectorptr_exceptiondefinition() {
    this(RobotRaconteurJavaJNI.new_vectorptr_exceptiondefinition__SWIG_0(), true);
  }

  public vectorptr_exceptiondefinition(vectorptr_exceptiondefinition other) {
    this(RobotRaconteurJavaJNI.new_vectorptr_exceptiondefinition__SWIG_1(vectorptr_exceptiondefinition.getCPtr(other), other), true);
  }

  public boolean isEmpty() {
    return RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_isEmpty(swigCPtr, this);
  }

  public void clear() {
    RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_clear(swigCPtr, this);
  }

  public vectorptr_exceptiondefinition(int count, ExceptionDefinition value) {
    this(RobotRaconteurJavaJNI.new_vectorptr_exceptiondefinition__SWIG_2(count, ExceptionDefinition.getCPtr(value), value), true);
  }

  private int doCapacity() {
    return RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_doCapacity(swigCPtr, this);
  }

  private void doReserve(int n) {
    RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_doReserve(swigCPtr, this, n);
  }

  private int doSize() {
    return RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_doSize(swigCPtr, this);
  }

  private void doAdd(ExceptionDefinition x) {
    RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_doAdd__SWIG_0(swigCPtr, this, ExceptionDefinition.getCPtr(x), x);
  }

  private void doAdd(int index, ExceptionDefinition x) {
    RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_doAdd__SWIG_1(swigCPtr, this, index, ExceptionDefinition.getCPtr(x), x);
  }

  private ExceptionDefinition doRemove(int index) {
    long cPtr = RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_doRemove(swigCPtr, this, index);
    return (cPtr == 0) ? null : new ExceptionDefinition(cPtr, true);
  }

  private ExceptionDefinition doGet(int index) {
    long cPtr = RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_doGet(swigCPtr, this, index);
    return (cPtr == 0) ? null : new ExceptionDefinition(cPtr, true);
  }

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

  private void doRemoveRange(int fromIndex, int toIndex) {
    RobotRaconteurJavaJNI.vectorptr_exceptiondefinition_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
  }

}
