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 Bond extends Instrument implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 private transient boolean swigCMemOwnDerived; 014 015 protected Bond(long cPtr, boolean cMemoryOwn) { 016 super(QuantLibJNI.Bond_SWIGSmartPtrUpcast(cPtr), true); 017 swigCMemOwnDerived = cMemoryOwn; 018 swigCPtr = cPtr; 019 } 020 021 protected static long getCPtr(Bond 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_Bond(swigCPtr); 040 } 041 swigCPtr = 0; 042 } 043 super.delete(); 044 } 045 046 public Bond(long settlementDays, Calendar calendar, double faceAmount, Date maturityDate, Date issueDate, Leg cashflows) { 047 this(QuantLibJNI.new_Bond__SWIG_0(settlementDays, Calendar.getCPtr(calendar), calendar, faceAmount, Date.getCPtr(maturityDate), maturityDate, Date.getCPtr(issueDate), issueDate, Leg.getCPtr(cashflows), cashflows), true); 048 } 049 050 public Bond(long settlementDays, Calendar calendar, double faceAmount, Date maturityDate, Date issueDate) { 051 this(QuantLibJNI.new_Bond__SWIG_1(settlementDays, Calendar.getCPtr(calendar), calendar, faceAmount, Date.getCPtr(maturityDate), maturityDate, Date.getCPtr(issueDate), issueDate), true); 052 } 053 054 public Bond(long settlementDays, Calendar calendar, double faceAmount, Date maturityDate) { 055 this(QuantLibJNI.new_Bond__SWIG_2(settlementDays, Calendar.getCPtr(calendar), calendar, faceAmount, Date.getCPtr(maturityDate), maturityDate), true); 056 } 057 058 public Bond(long settlementDays, Calendar calendar, Date issueDate, Leg coupons) { 059 this(QuantLibJNI.new_Bond__SWIG_3(settlementDays, Calendar.getCPtr(calendar), calendar, Date.getCPtr(issueDate), issueDate, Leg.getCPtr(coupons), coupons), true); 060 } 061 062 public Bond(long settlementDays, Calendar calendar, Date issueDate) { 063 this(QuantLibJNI.new_Bond__SWIG_4(settlementDays, Calendar.getCPtr(calendar), calendar, Date.getCPtr(issueDate), issueDate), true); 064 } 065 066 public Bond(long settlementDays, Calendar calendar) { 067 this(QuantLibJNI.new_Bond__SWIG_5(settlementDays, Calendar.getCPtr(calendar), calendar), true); 068 } 069 070 public double nextCouponRate(Date d) { 071 return QuantLibJNI.Bond_nextCouponRate__SWIG_0(swigCPtr, this, Date.getCPtr(d), d); 072 } 073 074 public double nextCouponRate() { 075 return QuantLibJNI.Bond_nextCouponRate__SWIG_1(swigCPtr, this); 076 } 077 078 public double previousCouponRate(Date d) { 079 return QuantLibJNI.Bond_previousCouponRate__SWIG_0(swigCPtr, this, Date.getCPtr(d), d); 080 } 081 082 public double previousCouponRate() { 083 return QuantLibJNI.Bond_previousCouponRate__SWIG_1(swigCPtr, this); 084 } 085 086 public long settlementDays() { 087 return QuantLibJNI.Bond_settlementDays(swigCPtr, this); 088 } 089 090 public Date settlementDate(Date d) { 091 return new Date(QuantLibJNI.Bond_settlementDate__SWIG_0(swigCPtr, this, Date.getCPtr(d), d), true); 092 } 093 094 public Date settlementDate() { 095 return new Date(QuantLibJNI.Bond_settlementDate__SWIG_1(swigCPtr, this), true); 096 } 097 098 public Date startDate() { 099 return new Date(QuantLibJNI.Bond_startDate(swigCPtr, this), true); 100 } 101 102 public Date maturityDate() { 103 return new Date(QuantLibJNI.Bond_maturityDate(swigCPtr, this), true); 104 } 105 106 public Date issueDate() { 107 return new Date(QuantLibJNI.Bond_issueDate(swigCPtr, this), true); 108 } 109 110 public Leg cashflows() { 111 return new Leg(QuantLibJNI.Bond_cashflows(swigCPtr, this), true); 112 } 113 114 public Leg redemptions() { 115 return new Leg(QuantLibJNI.Bond_redemptions(swigCPtr, this), true); 116 } 117 118 public CashFlow redemption() { 119 long cPtr = QuantLibJNI.Bond_redemption(swigCPtr, this); 120 return (cPtr == 0) ? null : new CashFlow(cPtr, true); 121 } 122 123 public Calendar calendar() { 124 return new Calendar(QuantLibJNI.Bond_calendar(swigCPtr, this), true); 125 } 126 127 public DoubleVector notionals() { 128 return new DoubleVector(QuantLibJNI.Bond_notionals(swigCPtr, this), true); 129 } 130 131 public double notional(Date d) { 132 return QuantLibJNI.Bond_notional__SWIG_0(swigCPtr, this, Date.getCPtr(d), d); 133 } 134 135 public double notional() { 136 return QuantLibJNI.Bond_notional__SWIG_1(swigCPtr, this); 137 } 138 139 public double cleanPrice() { 140 return QuantLibJNI.Bond_cleanPrice__SWIG_0(swigCPtr, this); 141 } 142 143 public double cleanPrice(double yield, DayCounter dc, Compounding compounding, Frequency frequency, Date settlement) { 144 return QuantLibJNI.Bond_cleanPrice__SWIG_1(swigCPtr, this, yield, DayCounter.getCPtr(dc), dc, compounding.swigValue(), frequency.swigValue(), Date.getCPtr(settlement), settlement); 145 } 146 147 public double cleanPrice(double yield, DayCounter dc, Compounding compounding, Frequency frequency) { 148 return QuantLibJNI.Bond_cleanPrice__SWIG_2(swigCPtr, this, yield, DayCounter.getCPtr(dc), dc, compounding.swigValue(), frequency.swigValue()); 149 } 150 151 public double dirtyPrice() { 152 return QuantLibJNI.Bond_dirtyPrice__SWIG_0(swigCPtr, this); 153 } 154 155 public double dirtyPrice(double yield, DayCounter dc, Compounding compounding, Frequency frequency, Date settlement) { 156 return QuantLibJNI.Bond_dirtyPrice__SWIG_1(swigCPtr, this, yield, DayCounter.getCPtr(dc), dc, compounding.swigValue(), frequency.swigValue(), Date.getCPtr(settlement), settlement); 157 } 158 159 public double dirtyPrice(double yield, DayCounter dc, Compounding compounding, Frequency frequency) { 160 return QuantLibJNI.Bond_dirtyPrice__SWIG_2(swigCPtr, this, yield, DayCounter.getCPtr(dc), dc, compounding.swigValue(), frequency.swigValue()); 161 } 162 163 public double yield(DayCounter dc, Compounding compounding, Frequency freq, double accuracy, long maxEvaluations) { 164 return QuantLibJNI.Bond_yield__SWIG_0(swigCPtr, this, DayCounter.getCPtr(dc), dc, compounding.swigValue(), freq.swigValue(), accuracy, maxEvaluations); 165 } 166 167 public double yield(DayCounter dc, Compounding compounding, Frequency freq, double accuracy) { 168 return QuantLibJNI.Bond_yield__SWIG_1(swigCPtr, this, DayCounter.getCPtr(dc), dc, compounding.swigValue(), freq.swigValue(), accuracy); 169 } 170 171 public double yield(DayCounter dc, Compounding compounding, Frequency freq) { 172 return QuantLibJNI.Bond_yield__SWIG_2(swigCPtr, this, DayCounter.getCPtr(dc), dc, compounding.swigValue(), freq.swigValue()); 173 } 174 175 public double yield(double cleanPrice, DayCounter dc, Compounding compounding, Frequency freq, Date settlement, double accuracy, long maxEvaluations) { 176 return QuantLibJNI.Bond_yield__SWIG_3(swigCPtr, this, cleanPrice, DayCounter.getCPtr(dc), dc, compounding.swigValue(), freq.swigValue(), Date.getCPtr(settlement), settlement, accuracy, maxEvaluations); 177 } 178 179 public double yield(double cleanPrice, DayCounter dc, Compounding compounding, Frequency freq, Date settlement, double accuracy) { 180 return QuantLibJNI.Bond_yield__SWIG_4(swigCPtr, this, cleanPrice, DayCounter.getCPtr(dc), dc, compounding.swigValue(), freq.swigValue(), Date.getCPtr(settlement), settlement, accuracy); 181 } 182 183 public double yield(double cleanPrice, DayCounter dc, Compounding compounding, Frequency freq, Date settlement) { 184 return QuantLibJNI.Bond_yield__SWIG_5(swigCPtr, this, cleanPrice, DayCounter.getCPtr(dc), dc, compounding.swigValue(), freq.swigValue(), Date.getCPtr(settlement), settlement); 185 } 186 187 public double yield(double cleanPrice, DayCounter dc, Compounding compounding, Frequency freq) { 188 return QuantLibJNI.Bond_yield__SWIG_6(swigCPtr, this, cleanPrice, DayCounter.getCPtr(dc), dc, compounding.swigValue(), freq.swigValue()); 189 } 190 191 public double accruedAmount(Date settlement) { 192 return QuantLibJNI.Bond_accruedAmount__SWIG_0(swigCPtr, this, Date.getCPtr(settlement), settlement); 193 } 194 195 public double accruedAmount() { 196 return QuantLibJNI.Bond_accruedAmount__SWIG_1(swigCPtr, this); 197 } 198 199 public double settlementValue() { 200 return QuantLibJNI.Bond_settlementValue__SWIG_0(swigCPtr, this); 201 } 202 203 public double settlementValue(double cleanPrice) { 204 return QuantLibJNI.Bond_settlementValue__SWIG_1(swigCPtr, this, cleanPrice); 205 } 206 207}