org.quantlib.DayCounter 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 DayCounter implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected DayCounter(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(DayCounter obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected static long swigRelease(DayCounter 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_DayCounter(swigCPtr);
}
swigCPtr = 0;
}
}
public int dayCount(Date d1, Date d2) {
return QuantLibJNI.DayCounter_dayCount(swigCPtr, this, Date.getCPtr(d1), d1, Date.getCPtr(d2), d2);
}
public double yearFraction(Date d1, Date d2, Date startRef, Date endRef) {
return QuantLibJNI.DayCounter_yearFraction__SWIG_0(swigCPtr, this, Date.getCPtr(d1), d1, Date.getCPtr(d2), d2, Date.getCPtr(startRef), startRef, Date.getCPtr(endRef), endRef);
}
public double yearFraction(Date d1, Date d2, Date startRef) {
return QuantLibJNI.DayCounter_yearFraction__SWIG_1(swigCPtr, this, Date.getCPtr(d1), d1, Date.getCPtr(d2), d2, Date.getCPtr(startRef), startRef);
}
public double yearFraction(Date d1, Date d2) {
return QuantLibJNI.DayCounter_yearFraction__SWIG_2(swigCPtr, this, Date.getCPtr(d1), d1, Date.getCPtr(d2), d2);
}
public String name() {
return QuantLibJNI.DayCounter_name(swigCPtr, this);
}
public boolean empty() {
return QuantLibJNI.DayCounter_empty(swigCPtr, this);
}
public String toString() {
return QuantLibJNI.DayCounter_toString(swigCPtr, this);
}
public boolean equals(DayCounter other) {
return QuantLibJNI.DayCounter_equals(swigCPtr, this, DayCounter.getCPtr(other), other);
}
public boolean unEquals(DayCounter other) {
return QuantLibJNI.DayCounter_unEquals(swigCPtr, this, DayCounter.getCPtr(other), other);
}
public int hashCode() {
return QuantLibJNI.DayCounter_hashCode(swigCPtr, this);
}
}