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 MakeVanillaSwap implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013  protected transient boolean swigCMemOwn;
014
015  protected MakeVanillaSwap(long cPtr, boolean cMemoryOwn) {
016    swigCMemOwn = cMemoryOwn;
017    swigCPtr = cPtr;
018  }
019
020  protected static long getCPtr(MakeVanillaSwap obj) {
021    return (obj == null) ? 0 : obj.swigCPtr;
022  }
023
024  protected static long swigRelease(MakeVanillaSwap obj) {
025    long ptr = 0;
026    if (obj != null) {
027      if (!obj.swigCMemOwn)
028        throw new RuntimeException("Cannot release ownership as memory is not owned");
029      ptr = obj.swigCPtr;
030      obj.swigCMemOwn = false;
031      obj.delete();
032    }
033    return ptr;
034  }
035
036  @SuppressWarnings("deprecation")
037  protected void finalize() {
038    delete();
039  }
040
041  public synchronized void delete() {
042    if (swigCPtr != 0) {
043      if (swigCMemOwn) {
044        swigCMemOwn = false;
045        QuantLibJNI.delete_MakeVanillaSwap(swigCPtr);
046      }
047      swigCPtr = 0;
048    }
049  }
050
051  public MakeVanillaSwap receiveFixed(boolean flag) {
052    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_receiveFixed__SWIG_0(swigCPtr, this, flag), false);
053  }
054
055  public MakeVanillaSwap receiveFixed() {
056    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_receiveFixed__SWIG_1(swigCPtr, this), false);
057  }
058
059  public MakeVanillaSwap withType(Swap.Type type) {
060    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withType(swigCPtr, this, type.swigValue()), false);
061  }
062
063  public MakeVanillaSwap withNominal(double n) {
064    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withNominal(swigCPtr, this, n), false);
065  }
066
067  public MakeVanillaSwap withSettlementDays(long settlementDays) {
068    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withSettlementDays(swigCPtr, this, settlementDays), false);
069  }
070
071  public MakeVanillaSwap withEffectiveDate(Date arg0) {
072    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withEffectiveDate(swigCPtr, this, Date.getCPtr(arg0), arg0), false);
073  }
074
075  public MakeVanillaSwap withTerminationDate(Date arg0) {
076    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withTerminationDate(swigCPtr, this, Date.getCPtr(arg0), arg0), false);
077  }
078
079  public MakeVanillaSwap withRule(DateGeneration.Rule r) {
080    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withRule(swigCPtr, this, r.swigValue()), false);
081  }
082
083  public MakeVanillaSwap withFixedLegTenor(Period t) {
084    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegTenor(swigCPtr, this, Period.getCPtr(t), t), false);
085  }
086
087  public MakeVanillaSwap withFixedLegCalendar(Calendar cal) {
088    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegCalendar(swigCPtr, this, Calendar.getCPtr(cal), cal), false);
089  }
090
091  public MakeVanillaSwap withFixedLegConvention(BusinessDayConvention bdc) {
092    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegConvention(swigCPtr, this, bdc.swigValue()), false);
093  }
094
095  public MakeVanillaSwap withFixedLegTerminationDateConvention(BusinessDayConvention bdc) {
096    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegTerminationDateConvention(swigCPtr, this, bdc.swigValue()), false);
097  }
098
099  public MakeVanillaSwap withFixedLegRule(DateGeneration.Rule r) {
100    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegRule(swigCPtr, this, r.swigValue()), false);
101  }
102
103  public MakeVanillaSwap withFixedLegEndOfMonth(boolean flag) {
104    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegEndOfMonth__SWIG_0(swigCPtr, this, flag), false);
105  }
106
107  public MakeVanillaSwap withFixedLegEndOfMonth() {
108    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegEndOfMonth__SWIG_1(swigCPtr, this), false);
109  }
110
111  public MakeVanillaSwap withFixedLegFirstDate(Date d) {
112    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegFirstDate(swigCPtr, this, Date.getCPtr(d), d), false);
113  }
114
115  public MakeVanillaSwap withFixedLegNextToLastDate(Date d) {
116    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegNextToLastDate(swigCPtr, this, Date.getCPtr(d), d), false);
117  }
118
119  public MakeVanillaSwap withFixedLegDayCount(DayCounter dc) {
120    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFixedLegDayCount(swigCPtr, this, DayCounter.getCPtr(dc), dc), false);
121  }
122
123  public MakeVanillaSwap withFloatingLegTenor(Period t) {
124    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegTenor(swigCPtr, this, Period.getCPtr(t), t), false);
125  }
126
127  public MakeVanillaSwap withFloatingLegCalendar(Calendar cal) {
128    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegCalendar(swigCPtr, this, Calendar.getCPtr(cal), cal), false);
129  }
130
131  public MakeVanillaSwap withFloatingLegConvention(BusinessDayConvention bdc) {
132    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegConvention(swigCPtr, this, bdc.swigValue()), false);
133  }
134
135  public MakeVanillaSwap withFloatingLegTerminationDateConvention(BusinessDayConvention bdc) {
136    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegTerminationDateConvention(swigCPtr, this, bdc.swigValue()), false);
137  }
138
139  public MakeVanillaSwap withFloatingLegRule(DateGeneration.Rule r) {
140    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegRule(swigCPtr, this, r.swigValue()), false);
141  }
142
143  public MakeVanillaSwap withFloatingLegEndOfMonth(boolean flag) {
144    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegEndOfMonth__SWIG_0(swigCPtr, this, flag), false);
145  }
146
147  public MakeVanillaSwap withFloatingLegEndOfMonth() {
148    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegEndOfMonth__SWIG_1(swigCPtr, this), false);
149  }
150
151  public MakeVanillaSwap withFloatingLegFirstDate(Date d) {
152    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegFirstDate(swigCPtr, this, Date.getCPtr(d), d), false);
153  }
154
155  public MakeVanillaSwap withFloatingLegNextToLastDate(Date d) {
156    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegNextToLastDate(swigCPtr, this, Date.getCPtr(d), d), false);
157  }
158
159  public MakeVanillaSwap withFloatingLegDayCount(DayCounter dc) {
160    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegDayCount(swigCPtr, this, DayCounter.getCPtr(dc), dc), false);
161  }
162
163  public MakeVanillaSwap withFloatingLegSpread(double sp) {
164    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withFloatingLegSpread(swigCPtr, this, sp), false);
165  }
166
167  public MakeVanillaSwap withDiscountingTermStructure(YieldTermStructureHandle discountCurve) {
168    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withDiscountingTermStructure(swigCPtr, this, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve), false);
169  }
170
171  public MakeVanillaSwap withPricingEngine(PricingEngine engine) {
172    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withPricingEngine(swigCPtr, this, PricingEngine.getCPtr(engine), engine), false);
173  }
174
175  public MakeVanillaSwap withIndexedCoupons(boolean flag) {
176    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withIndexedCoupons__SWIG_0(swigCPtr, this, flag), false);
177  }
178
179  public MakeVanillaSwap withIndexedCoupons() {
180    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withIndexedCoupons__SWIG_1(swigCPtr, this), false);
181  }
182
183  public MakeVanillaSwap withAtParCoupons(boolean flag) {
184    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withAtParCoupons__SWIG_0(swigCPtr, this, flag), false);
185  }
186
187  public MakeVanillaSwap withAtParCoupons() {
188    return new MakeVanillaSwap(QuantLibJNI.MakeVanillaSwap_withAtParCoupons__SWIG_1(swigCPtr, this), false);
189  }
190
191  public MakeVanillaSwap(Period swapTenor, IborIndex index, double fixedRate, Period forwardStart) {
192    this(QuantLibJNI.new_MakeVanillaSwap(Period.getCPtr(swapTenor), swapTenor, IborIndex.getCPtr(index), index, fixedRate, Period.getCPtr(forwardStart), forwardStart), true);
193  }
194
195  public VanillaSwap makeVanillaSwap() {
196    long cPtr = QuantLibJNI.MakeVanillaSwap_makeVanillaSwap(swigCPtr, this);
197    return (cPtr == 0) ? null : new VanillaSwap(cPtr, true);
198  }
199
200}