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 YoYInflationCapFloor extends Instrument implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 private transient boolean swigCMemOwnDerived; 014 015 protected YoYInflationCapFloor(long cPtr, boolean cMemoryOwn) { 016 super(QuantLibJNI.YoYInflationCapFloor_SWIGSmartPtrUpcast(cPtr), true); 017 swigCMemOwnDerived = cMemoryOwn; 018 swigCPtr = cPtr; 019 } 020 021 protected static long getCPtr(YoYInflationCapFloor 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_YoYInflationCapFloor(swigCPtr); 040 } 041 swigCPtr = 0; 042 } 043 super.delete(); 044 } 045 046 public YoYInflationCapFloor(YoYInflationCapFloor.Type type, Leg yoyLeg, DoubleVector strikes) { 047 this(QuantLibJNI.new_YoYInflationCapFloor(type.swigValue(), Leg.getCPtr(yoyLeg), yoyLeg, DoubleVector.getCPtr(strikes), strikes), true); 048 } 049 050 public double impliedVolatility(double price, YoYInflationTermStructureHandle curve, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol) { 051 return QuantLibJNI.YoYInflationCapFloor_impliedVolatility__SWIG_0(swigCPtr, this, price, YoYInflationTermStructureHandle.getCPtr(curve), curve, guess, accuracy, maxEvaluations, minVol, maxVol); 052 } 053 054 public double impliedVolatility(double price, YoYInflationTermStructureHandle curve, double guess, double accuracy, long maxEvaluations, double minVol) { 055 return QuantLibJNI.YoYInflationCapFloor_impliedVolatility__SWIG_1(swigCPtr, this, price, YoYInflationTermStructureHandle.getCPtr(curve), curve, guess, accuracy, maxEvaluations, minVol); 056 } 057 058 public double impliedVolatility(double price, YoYInflationTermStructureHandle curve, double guess, double accuracy, long maxEvaluations) { 059 return QuantLibJNI.YoYInflationCapFloor_impliedVolatility__SWIG_2(swigCPtr, this, price, YoYInflationTermStructureHandle.getCPtr(curve), curve, guess, accuracy, maxEvaluations); 060 } 061 062 public double impliedVolatility(double price, YoYInflationTermStructureHandle curve, double guess, double accuracy) { 063 return QuantLibJNI.YoYInflationCapFloor_impliedVolatility__SWIG_3(swigCPtr, this, price, YoYInflationTermStructureHandle.getCPtr(curve), curve, guess, accuracy); 064 } 065 066 public double impliedVolatility(double price, YoYInflationTermStructureHandle curve, double guess) { 067 return QuantLibJNI.YoYInflationCapFloor_impliedVolatility__SWIG_4(swigCPtr, this, price, YoYInflationTermStructureHandle.getCPtr(curve), curve, guess); 068 } 069 070 public DoubleVector optionletPrices() { 071 return new DoubleVector(QuantLibJNI.YoYInflationCapFloor_optionletPrices(swigCPtr, this), true); 072 } 073 074 public final static class Type { 075 public final static YoYInflationCapFloor.Type Cap = new YoYInflationCapFloor.Type("Cap"); 076 public final static YoYInflationCapFloor.Type Floor = new YoYInflationCapFloor.Type("Floor"); 077 public final static YoYInflationCapFloor.Type Collar = new YoYInflationCapFloor.Type("Collar"); 078 079 public final int swigValue() { 080 return swigValue; 081 } 082 083 public String toString() { 084 return swigName; 085 } 086 087 public static Type swigToEnum(int swigValue) { 088 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 089 return swigValues[swigValue]; 090 for (int i = 0; i < swigValues.length; i++) 091 if (swigValues[i].swigValue == swigValue) 092 return swigValues[i]; 093 throw new IllegalArgumentException("No enum " + Type.class + " with value " + swigValue); 094 } 095 096 private Type(String swigName) { 097 this.swigName = swigName; 098 this.swigValue = swigNext++; 099 } 100 101 private Type(String swigName, int swigValue) { 102 this.swigName = swigName; 103 this.swigValue = swigValue; 104 swigNext = swigValue+1; 105 } 106 107 private Type(String swigName, Type swigEnum) { 108 this.swigName = swigName; 109 this.swigValue = swigEnum.swigValue; 110 swigNext = this.swigValue+1; 111 } 112 113 private static Type[] swigValues = { Cap, Floor, Collar }; 114 private static int swigNext = 0; 115 private final int swigValue; 116 private final String swigName; 117 } 118 119}