001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (https://www.swig.org). 003 * Version 4.1.1 004 * 005 * Do not make changes to this file unless you know what you are doing - modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.quantlib; 010 011public class SwapSpreadIndex extends InterestRateIndex implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 private transient boolean swigCMemOwnDerived; 014 015 protected SwapSpreadIndex(long cPtr, boolean cMemoryOwn) { 016 super(QuantLibJNI.SwapSpreadIndex_SWIGSmartPtrUpcast(cPtr), true); 017 swigCMemOwnDerived = cMemoryOwn; 018 swigCPtr = cPtr; 019 } 020 021 protected static long getCPtr(SwapSpreadIndex obj) { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected void swigSetCMemOwn(boolean own) { 026 swigCMemOwnDerived = own; 027 super.swigSetCMemOwn(own); 028 } 029 030 @SuppressWarnings("deprecation") 031 protected void finalize() { 032 delete(); 033 } 034 035 public synchronized void delete() { 036 if (swigCPtr != 0) { 037 if (swigCMemOwnDerived) { 038 swigCMemOwnDerived = false; 039 QuantLibJNI.delete_SwapSpreadIndex(swigCPtr); 040 } 041 swigCPtr = 0; 042 } 043 super.delete(); 044 } 045 046 public SwapSpreadIndex(String familyName, SwapIndex swapIndex1, SwapIndex swapIndex2, double gearing1, double gearing2) { 047 this(QuantLibJNI.new_SwapSpreadIndex__SWIG_0(familyName, SwapIndex.getCPtr(swapIndex1), swapIndex1, SwapIndex.getCPtr(swapIndex2), swapIndex2, gearing1, gearing2), true); 048 } 049 050 public SwapSpreadIndex(String familyName, SwapIndex swapIndex1, SwapIndex swapIndex2, double gearing1) { 051 this(QuantLibJNI.new_SwapSpreadIndex__SWIG_1(familyName, SwapIndex.getCPtr(swapIndex1), swapIndex1, SwapIndex.getCPtr(swapIndex2), swapIndex2, gearing1), true); 052 } 053 054 public SwapSpreadIndex(String familyName, SwapIndex swapIndex1, SwapIndex swapIndex2) { 055 this(QuantLibJNI.new_SwapSpreadIndex__SWIG_2(familyName, SwapIndex.getCPtr(swapIndex1), swapIndex1, SwapIndex.getCPtr(swapIndex2), swapIndex2), true); 056 } 057 058 public double forecastFixing(Date fixingDate) { 059 return QuantLibJNI.SwapSpreadIndex_forecastFixing(swigCPtr, this, Date.getCPtr(fixingDate), fixingDate); 060 } 061 062 public double pastFixing(Date fixingDate) { 063 return QuantLibJNI.SwapSpreadIndex_pastFixing(swigCPtr, this, Date.getCPtr(fixingDate), fixingDate); 064 } 065 066 public SwapIndex swapIndex1() { 067 long cPtr = QuantLibJNI.SwapSpreadIndex_swapIndex1(swigCPtr, this); 068 return (cPtr == 0) ? null : new SwapIndex(cPtr, true); 069 } 070 071 public SwapIndex swapIndex2() { 072 long cPtr = QuantLibJNI.SwapSpreadIndex_swapIndex2(swigCPtr, this); 073 return (cPtr == 0) ? null : new SwapIndex(cPtr, true); 074 } 075 076 public double gearing1() { 077 return QuantLibJNI.SwapSpreadIndex_gearing1(swigCPtr, this); 078 } 079 080 public double gearing2() { 081 return QuantLibJNI.SwapSpreadIndex_gearing2(swigCPtr, this); 082 } 083 084}