org.quantlib.DateVector 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 DateVector extends java.util.AbstractList implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable, java.util.RandomAccess {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected DateVector(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(DateVector obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected static long swigRelease(DateVector 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_DateVector(swigCPtr);
}
swigCPtr = 0;
}
}
public DateVector(Date[] initialElements) {
this();
reserve(initialElements.length);
for (Date element : initialElements) {
add(element);
}
}
public DateVector(Iterable initialElements) {
this();
for (Date element : initialElements) {
add(element);
}
}
public Date get(int index) {
return doGet(index);
}
public Date set(int index, Date e) {
return doSet(index, e);
}
public boolean add(Date e) {
modCount++;
doAdd(e);
return true;
}
public void add(int index, Date e) {
modCount++;
doAdd(index, e);
}
public Date 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 DateVector() {
this(QuantLibJNI.new_DateVector__SWIG_0(), true);
}
public DateVector(DateVector other) {
this(QuantLibJNI.new_DateVector__SWIG_1(DateVector.getCPtr(other), other), true);
}
public boolean isEmpty() {
return QuantLibJNI.DateVector_isEmpty(swigCPtr, this);
}
public void clear() {
QuantLibJNI.DateVector_clear(swigCPtr, this);
}
public DateVector(int count, Date value) {
this(QuantLibJNI.new_DateVector__SWIG_2(count, Date.getCPtr(value), value), true);
}
private int doCapacity() {
return QuantLibJNI.DateVector_doCapacity(swigCPtr, this);
}
private void doReserve(int n) {
QuantLibJNI.DateVector_doReserve(swigCPtr, this, n);
}
private int doSize() {
return QuantLibJNI.DateVector_doSize(swigCPtr, this);
}
private void doAdd(Date x) {
QuantLibJNI.DateVector_doAdd__SWIG_0(swigCPtr, this, Date.getCPtr(x), x);
}
private void doAdd(int index, Date x) {
QuantLibJNI.DateVector_doAdd__SWIG_1(swigCPtr, this, index, Date.getCPtr(x), x);
}
private Date doRemove(int index) {
return new Date(QuantLibJNI.DateVector_doRemove(swigCPtr, this, index), true);
}
private Date doGet(int index) {
return new Date(QuantLibJNI.DateVector_doGet(swigCPtr, this, index), false);
}
private Date doSet(int index, Date val) {
return new Date(QuantLibJNI.DateVector_doSet(swigCPtr, this, index, Date.getCPtr(val), val), true);
}
private void doRemoveRange(int fromIndex, int toIndex) {
QuantLibJNI.DateVector_doRemoveRange(swigCPtr, this, fromIndex, toIndex);
}
}