org.quantlib.InstrumentVector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quantlib Show documentation
Show all versions of quantlib Show documentation
Java language binding for QuantLib
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (https://www.swig.org).
* Version 4.2.1
*
* Do not make changes to this file unless you know what you are doing - modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package org.quantlib;
public class InstrumentVector extends java.util.AbstractList implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable, java.util.RandomAccess {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected InstrumentVector(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(InstrumentVector obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected static long swigRelease(InstrumentVector 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;
QuantLibJNI.delete_InstrumentVector(swigCPtr);
}
swigCPtr = 0;
}
}
public InstrumentVector(Instrument[] initialElements) {
this();
reserve(initialElements.length);
for (Instrument element : initialElements) {
add(element);
}
}
public InstrumentVector(Iterable initialElements) {
this();
for (Instrument element : initialElements) {
add(element);
}
}
public Instrument get(int index) {
return doGet(index);
}
public Instrument set(int index, Instrument e) {
return doSet(index, e);
}
public boolean add(Instrument e) {
modCount++;
doAdd(e);
return true;
}
public void add(int index, Instrument e) {
modCount++;
doAdd(index, e);
}
public Instrument 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 InstrumentVector() {
this(QuantLibJNI.new_InstrumentVector__SWIG_0(), true);
}
public InstrumentVector(InstrumentVector other) {
this(QuantLibJNI.new_InstrumentVector__SWIG_1(InstrumentVector.getCPtr(other), other), true);
}
public boolean isEmpty() {
return QuantLibJNI.InstrumentVector_isEmpty(swigCPtr, this);
}
public void clear() {
QuantLibJNI.InstrumentVector_clear(swigCPtr, this);
}
public InstrumentVector(int count, Instrument value) {
this(QuantLibJNI.new_InstrumentVector__SWIG_2(count, Instrument.getCPtr(value), value), true);
}
private int doCapacity() {
return QuantLibJNI.InstrumentVector_doCapacity(swigCPtr, this);
}
private void doReserve(int n) {
QuantLibJNI.InstrumentVector_doReserve(swigCPtr, this, n);
}
private int doSize() {
return QuantLibJNI.InstrumentVector_doSize(swigCPtr, this);
}
private void doAdd(Instrument x) {
QuantLibJNI.InstrumentVector_doAdd__SWIG_0(swigCPtr, this, Instrument.getCPtr(x), x);
}
private void doAdd(int index, Instrument x) {
QuantLibJNI.InstrumentVector_doAdd__SWIG_1(swigCPtr, this, index, Instrument.getCPtr(x), x);
}
private Instrument doRemove(int index) {
long cPtr = QuantLibJNI.InstrumentVector_doRemove(swigCPtr, this, index);
return (cPtr == 0) ? null : new Instrument(cPtr, true);
}
private Instrument doGet(int index) {
long cPtr = QuantLibJNI.InstrumentVector_doGet(swigCPtr, this, index);
return (cPtr == 0) ? null : new Instrument(cPtr, true);
}
private Instrument doSet(int index, Instrument val) {
long cPtr = QuantLibJNI.InstrumentVector_doSet(swigCPtr, this, index, Instrument.getCPtr(val), val);
return (cPtr == 0) ? null : new Instrument(cPtr, true);
}
private void doRemoveRange(int fromIndex, int toIndex) {
QuantLibJNI.InstrumentVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
}
}