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

package spinal.sim.xsi;

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

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

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

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

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

  public VecI8(byte[] initialElements) {
    this();
    reserve(initialElements.length);

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

  public VecI8(Iterable<Byte> initialElements) {
    this();
    for (byte element : initialElements) {
      add(element);
    }
  }

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

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

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

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

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

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

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

  public VecI8() {
    this(JNIXSIIfaceJNI.new_VecI8__SWIG_0(), true);
  }

  public VecI8(VecI8 other) {
    this(JNIXSIIfaceJNI.new_VecI8__SWIG_1(VecI8.getCPtr(other), other), true);
  }

  public long capacity() {
    return JNIXSIIfaceJNI.VecI8_capacity(swigCPtr, this);
  }

  public void reserve(long n) {
    JNIXSIIfaceJNI.VecI8_reserve(swigCPtr, this, n);
  }

  public boolean isEmpty() {
    return JNIXSIIfaceJNI.VecI8_isEmpty(swigCPtr, this);
  }

  public void clear() {
    JNIXSIIfaceJNI.VecI8_clear(swigCPtr, this);
  }

  public VecI8(int count, byte value) {
    this(JNIXSIIfaceJNI.new_VecI8__SWIG_2(count, value), true);
  }

  private int doSize() {
    return JNIXSIIfaceJNI.VecI8_doSize(swigCPtr, this);
  }

  private void doAdd(byte x) {
    JNIXSIIfaceJNI.VecI8_doAdd__SWIG_0(swigCPtr, this, x);
  }

  private void doAdd(int index, byte x) {
    JNIXSIIfaceJNI.VecI8_doAdd__SWIG_1(swigCPtr, this, index, x);
  }

  private byte doRemove(int index) {
    return JNIXSIIfaceJNI.VecI8_doRemove(swigCPtr, this, index);
  }

  private byte doGet(int index) {
    return JNIXSIIfaceJNI.VecI8_doGet(swigCPtr, this, index);
  }

  private byte doSet(int index, byte val) {
    return JNIXSIIfaceJNI.VecI8_doSet(swigCPtr, this, index, val);
  }

  private void doRemoveRange(int fromIndex, int toIndex) {
    JNIXSIIfaceJNI.VecI8_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
  }

}
