/* ----------------------------------------------------------------------------
* 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 com.inscoper.api;
import com.inscoper.api.logging.*;
public class UShortVector extends java.util.AbstractList<Integer> implements java.util.RandomAccess {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected UShortVector(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(UShortVector obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected static long swigRelease(UShortVector 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;
InscoperJNI.delete_UShortVector(swigCPtr);
}
swigCPtr = 0;
}
}
public UShortVector(int[] initialElements) {
this();
reserve(initialElements.length);
for (int element : initialElements) {
add(element);
}
}
public UShortVector(Iterable<Integer> initialElements) {
this();
for (int element : initialElements) {
add(element);
}
}
@Override
public Integer get(int index) {
return doGet(index);
}
@Override
public Integer set(int index, Integer e) {
return doSet(index, e);
}
@Override
public boolean add(Integer e) {
modCount++;
doAdd(e);
return true;
}
@Override
public void add(int index, Integer e) {
modCount++;
doAdd(index, e);
}
@Override
public Integer remove(int index) {
modCount++;
return doRemove(index);
}
@Override
protected void removeRange(int fromIndex, int toIndex) {
modCount++;
doRemoveRange(fromIndex, toIndex);
}
@Override
public int size() {
return doSize();
}
@Override
public boolean isEmpty() {
return empty();
}
@Override
public void clear() {
doClear();
}
public UShortVector() {
this(InscoperJNI.new_UShortVector__SWIG_0(), true);
}
public UShortVector(UShortVector other) {
this(InscoperJNI.new_UShortVector__SWIG_1(UShortVector.getCPtr(other), other), true);
}
public long capacity() {
return InscoperJNI.UShortVector_capacity(swigCPtr, this);
}
public void reserve(long n) {
InscoperJNI.UShortVector_reserve(swigCPtr, this, n);
}
public boolean empty() {
return InscoperJNI.UShortVector_empty(swigCPtr, this);
}
public void doClear() {
InscoperJNI.UShortVector_doClear(swigCPtr, this);
}
public UShortVector(int count, int value) {
this(InscoperJNI.new_UShortVector__SWIG_2(count, value), true);
}
private int doSize() {
return InscoperJNI.UShortVector_doSize(swigCPtr, this);
}
private void doAdd(int x) {
InscoperJNI.UShortVector_doAdd__SWIG_0(swigCPtr, this, x);
}
private void doAdd(int index, int x) {
InscoperJNI.UShortVector_doAdd__SWIG_1(swigCPtr, this, index, x);
}
private int doRemove(int index) {
return InscoperJNI.UShortVector_doRemove(swigCPtr, this, index);
}
private int doGet(int index) {
return InscoperJNI.UShortVector_doGet(swigCPtr, this, index);
}
private int doSet(int index, int val) {
return InscoperJNI.UShortVector_doSet(swigCPtr, this, index, val);
}
private void doRemoveRange(int fromIndex, int toIndex) {
InscoperJNI.UShortVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
}
}