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 DeltaVolQuote extends Quote implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 private transient boolean swigCMemOwnDerived; 014 015 protected DeltaVolQuote(long cPtr, boolean cMemoryOwn) { 016 super(QuantLibJNI.DeltaVolQuote_SWIGSmartPtrUpcast(cPtr), true); 017 swigCMemOwnDerived = cMemoryOwn; 018 swigCPtr = cPtr; 019 } 020 021 protected static long getCPtr(DeltaVolQuote 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_DeltaVolQuote(swigCPtr); 040 } 041 swigCPtr = 0; 042 } 043 super.delete(); 044 } 045 046 public DeltaVolQuote(double delta, QuoteHandle vol, double maturity, DeltaVolQuote.DeltaType deltaType) { 047 this(QuantLibJNI.new_DeltaVolQuote__SWIG_0(delta, QuoteHandle.getCPtr(vol), vol, maturity, deltaType.swigValue()), true); 048 } 049 050 public DeltaVolQuote(QuoteHandle vol, DeltaVolQuote.DeltaType deltaType, double maturity, DeltaVolQuote.AtmType atmType) { 051 this(QuantLibJNI.new_DeltaVolQuote__SWIG_1(QuoteHandle.getCPtr(vol), vol, deltaType.swigValue(), maturity, atmType.swigValue()), true); 052 } 053 054 public double delta() { 055 return QuantLibJNI.DeltaVolQuote_delta(swigCPtr, this); 056 } 057 058 public double maturity() { 059 return QuantLibJNI.DeltaVolQuote_maturity(swigCPtr, this); 060 } 061 062 public DeltaVolQuote.AtmType atmType() { 063 return DeltaVolQuote.AtmType.swigToEnum(QuantLibJNI.DeltaVolQuote_atmType(swigCPtr, this)); 064 } 065 066 public DeltaVolQuote.DeltaType deltaType() { 067 return DeltaVolQuote.DeltaType.swigToEnum(QuantLibJNI.DeltaVolQuote_deltaType(swigCPtr, this)); 068 } 069 070 public final static class DeltaType { 071 public final static DeltaVolQuote.DeltaType Spot = new DeltaVolQuote.DeltaType("Spot"); 072 public final static DeltaVolQuote.DeltaType Fwd = new DeltaVolQuote.DeltaType("Fwd"); 073 public final static DeltaVolQuote.DeltaType PaSpot = new DeltaVolQuote.DeltaType("PaSpot"); 074 public final static DeltaVolQuote.DeltaType PaFwd = new DeltaVolQuote.DeltaType("PaFwd"); 075 076 public final int swigValue() { 077 return swigValue; 078 } 079 080 public String toString() { 081 return swigName; 082 } 083 084 public static DeltaType swigToEnum(int swigValue) { 085 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 086 return swigValues[swigValue]; 087 for (int i = 0; i < swigValues.length; i++) 088 if (swigValues[i].swigValue == swigValue) 089 return swigValues[i]; 090 throw new IllegalArgumentException("No enum " + DeltaType.class + " with value " + swigValue); 091 } 092 093 private DeltaType(String swigName) { 094 this.swigName = swigName; 095 this.swigValue = swigNext++; 096 } 097 098 private DeltaType(String swigName, int swigValue) { 099 this.swigName = swigName; 100 this.swigValue = swigValue; 101 swigNext = swigValue+1; 102 } 103 104 private DeltaType(String swigName, DeltaType swigEnum) { 105 this.swigName = swigName; 106 this.swigValue = swigEnum.swigValue; 107 swigNext = this.swigValue+1; 108 } 109 110 private static DeltaType[] swigValues = { Spot, Fwd, PaSpot, PaFwd }; 111 private static int swigNext = 0; 112 private final int swigValue; 113 private final String swigName; 114 } 115 116 public final static class AtmType { 117 public final static DeltaVolQuote.AtmType AtmNull = new DeltaVolQuote.AtmType("AtmNull"); 118 public final static DeltaVolQuote.AtmType AtmSpot = new DeltaVolQuote.AtmType("AtmSpot"); 119 public final static DeltaVolQuote.AtmType AtmFwd = new DeltaVolQuote.AtmType("AtmFwd"); 120 public final static DeltaVolQuote.AtmType AtmDeltaNeutral = new DeltaVolQuote.AtmType("AtmDeltaNeutral"); 121 public final static DeltaVolQuote.AtmType AtmVegaMax = new DeltaVolQuote.AtmType("AtmVegaMax"); 122 public final static DeltaVolQuote.AtmType AtmGammaMax = new DeltaVolQuote.AtmType("AtmGammaMax"); 123 public final static DeltaVolQuote.AtmType AtmPutCall50 = new DeltaVolQuote.AtmType("AtmPutCall50"); 124 125 public final int swigValue() { 126 return swigValue; 127 } 128 129 public String toString() { 130 return swigName; 131 } 132 133 public static AtmType swigToEnum(int swigValue) { 134 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 135 return swigValues[swigValue]; 136 for (int i = 0; i < swigValues.length; i++) 137 if (swigValues[i].swigValue == swigValue) 138 return swigValues[i]; 139 throw new IllegalArgumentException("No enum " + AtmType.class + " with value " + swigValue); 140 } 141 142 private AtmType(String swigName) { 143 this.swigName = swigName; 144 this.swigValue = swigNext++; 145 } 146 147 private AtmType(String swigName, int swigValue) { 148 this.swigName = swigName; 149 this.swigValue = swigValue; 150 swigNext = swigValue+1; 151 } 152 153 private AtmType(String swigName, AtmType swigEnum) { 154 this.swigName = swigName; 155 this.swigValue = swigEnum.swigValue; 156 swigNext = this.swigValue+1; 157 } 158 159 private static AtmType[] swigValues = { AtmNull, AtmSpot, AtmFwd, AtmDeltaNeutral, AtmVegaMax, AtmGammaMax, AtmPutCall50 }; 160 private static int swigNext = 0; 161 private final int swigValue; 162 private final String swigName; 163 } 164 165}