/* ----------------------------------------------------------------------------
* 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 RecipeElementSimpleVector extends java.util.AbstractList<RecipeElementSimple> implements java.util.RandomAccess {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected RecipeElementSimpleVector(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(RecipeElementSimpleVector obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected static long swigRelease(RecipeElementSimpleVector 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_RecipeElementSimpleVector(swigCPtr);
}
swigCPtr = 0;
}
}
public RecipeElementSimpleVector(RecipeElementSimple[] initialElements) {
this();
reserve(initialElements.length);
for (RecipeElementSimple element : initialElements) {
add(element);
}
}
public RecipeElementSimpleVector(Iterable<RecipeElementSimple> initialElements) {
this();
for (RecipeElementSimple element : initialElements) {
add(element);
}
}
@Override
public RecipeElementSimple get(int index) {
return doGet(index);
}
@Override
public RecipeElementSimple set(int index, RecipeElementSimple e) {
return doSet(index, e);
}
@Override
public boolean add(RecipeElementSimple e) {
modCount++;
doAdd(e);
return true;
}
@Override
public void add(int index, RecipeElementSimple e) {
modCount++;
doAdd(index, e);
}
@Override
public RecipeElementSimple 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 RecipeElementSimpleVector() {
this(InscoperJNI.new_RecipeElementSimpleVector__SWIG_0(), true);
}
public RecipeElementSimpleVector(RecipeElementSimpleVector other) {
this(InscoperJNI.new_RecipeElementSimpleVector__SWIG_1(RecipeElementSimpleVector.getCPtr(other), other), true);
}
public long capacity() {
return InscoperJNI.RecipeElementSimpleVector_capacity(swigCPtr, this);
}
public void reserve(long n) {
InscoperJNI.RecipeElementSimpleVector_reserve(swigCPtr, this, n);
}
public boolean empty() {
return InscoperJNI.RecipeElementSimpleVector_empty(swigCPtr, this);
}
public void doClear() {
InscoperJNI.RecipeElementSimpleVector_doClear(swigCPtr, this);
}
public RecipeElementSimpleVector(int count, RecipeElementSimple value) {
this(InscoperJNI.new_RecipeElementSimpleVector__SWIG_2(count, RecipeElementSimple.getCPtr(value), value), true);
}
private int doSize() {
return InscoperJNI.RecipeElementSimpleVector_doSize(swigCPtr, this);
}
private void doAdd(RecipeElementSimple x) {
InscoperJNI.RecipeElementSimpleVector_doAdd__SWIG_0(swigCPtr, this, RecipeElementSimple.getCPtr(x), x);
}
private void doAdd(int index, RecipeElementSimple x) {
InscoperJNI.RecipeElementSimpleVector_doAdd__SWIG_1(swigCPtr, this, index, RecipeElementSimple.getCPtr(x), x);
}
private RecipeElementSimple doRemove(int index) {
long cPtr = InscoperJNI.RecipeElementSimpleVector_doRemove(swigCPtr, this, index);
return (cPtr == 0) ? null : new RecipeElementSimple(cPtr, true);
}
private RecipeElementSimple doGet(int index) {
long cPtr = InscoperJNI.RecipeElementSimpleVector_doGet(swigCPtr, this, index);
return (cPtr == 0) ? null : new RecipeElementSimple(cPtr, true);
}
private RecipeElementSimple doSet(int index, RecipeElementSimple val) {
long cPtr = InscoperJNI.RecipeElementSimpleVector_doSet(swigCPtr, this, index, RecipeElementSimple.getCPtr(val), val);
return (cPtr == 0) ? null : new RecipeElementSimple(cPtr, true);
}
private void doRemoveRange(int fromIndex, int toIndex) {
InscoperJNI.RecipeElementSimpleVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
}
}