content: /* ----------------------------------------------------------------------------
   * This file was automatically generated by SWIG (https://www.swig.org).
   * Version 4.3.1
   *
   * Do not make changes to this file unless you know what you are doing - modify
   * the SWIG interface file instead.
   * ----------------------------------------------------------------------------- */
  
  package org.libtorrent4j.swig;
  
  public class stats_metric_vector extends java.util.AbstractList<stats_metric> implements java.util.RandomAccess {
    private transient long swigCPtr;
    protected transient boolean swigCMemOwn;
  
    protected stats_metric_vector(long cPtr, boolean cMemoryOwn) {
      swigCMemOwn = cMemoryOwn;
      swigCPtr = cPtr;
    }
  
    protected static long getCPtr(stats_metric_vector obj) {
      return (obj == null) ? 0 : obj.swigCPtr;
    }
  
    protected static long swigRelease(stats_metric_vector 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;
          libtorrent_jni.delete_stats_metric_vector(swigCPtr);
        }
        swigCPtr = 0;
      }
    }
  
    public stats_metric_vector(stats_metric[] initialElements) {
      this();
      reserve(initialElements.length);
  
      for (stats_metric element : initialElements) {
        add(element);
      }
    }
  
    public stats_metric_vector(Iterable<stats_metric> initialElements) {
      this();
      for (stats_metric element : initialElements) {
        add(element);
      }
    }
  
    public stats_metric get(int index) {
      return doGet(index);
    }
  
    public stats_metric set(int index, stats_metric e) {
      return doSet(index, e);
    }
  
    public boolean add(stats_metric e) {
      modCount++;
      doAdd(e);
      return true;
    }
  
    public void add(int index, stats_metric e) {
      modCount++;
      doAdd(index, e);
    }
  
    public stats_metric 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 stats_metric_vector() {
      this(libtorrent_jni.new_stats_metric_vector__SWIG_0(), true);
    }
  
    public stats_metric_vector(stats_metric_vector other) {
      this(libtorrent_jni.new_stats_metric_vector__SWIG_1(stats_metric_vector.getCPtr(other), other), true);
    }
  
    public boolean isEmpty() {
      return libtorrent_jni.stats_metric_vector_isEmpty(swigCPtr, this);
    }
  
    public void clear() {
      libtorrent_jni.stats_metric_vector_clear(swigCPtr, this);
    }
  
    public stats_metric_vector(int count, stats_metric value) {
      this(libtorrent_jni.new_stats_metric_vector__SWIG_2(count, stats_metric.getCPtr(value), value), true);
    }
  
    private int doCapacity() {
      return libtorrent_jni.stats_metric_vector_doCapacity(swigCPtr, this);
    }
  
    private void doReserve(int n) {
      libtorrent_jni.stats_metric_vector_doReserve(swigCPtr, this, n);
    }
  
    private int doSize() {
      return libtorrent_jni.stats_metric_vector_doSize(swigCPtr, this);
    }
  
    private void doAdd(stats_metric x) {
      libtorrent_jni.stats_metric_vector_doAdd__SWIG_0(swigCPtr, this, stats_metric.getCPtr(x), x);
    }
  
    private void doAdd(int index, stats_metric x) {
      libtorrent_jni.stats_metric_vector_doAdd__SWIG_1(swigCPtr, this, index, stats_metric.getCPtr(x), x);
    }
  
    private stats_metric doRemove(int index) {
      return new stats_metric(libtorrent_jni.stats_metric_vector_doRemove(swigCPtr, this, index), true);
    }
  
    private stats_metric doGet(int index) {
      return new stats_metric(libtorrent_jni.stats_metric_vector_doGet(swigCPtr, this, index), false);
    }
  
    private stats_metric doSet(int index, stats_metric val) {
      return new stats_metric(libtorrent_jni.stats_metric_vector_doSet(swigCPtr, this, index, stats_metric.getCPtr(val), val), true);
    }
  
    private void doRemoveRange(int fromIndex, int toIndex) {
      libtorrent_jni.stats_metric_vector_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
    }
  
  }
  