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 QdFpAmericanEngine extends PricingEngine implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 private transient boolean swigCMemOwnDerived; 014 015 protected QdFpAmericanEngine(long cPtr, boolean cMemoryOwn) { 016 super(QuantLibJNI.QdFpAmericanEngine_SWIGSmartPtrUpcast(cPtr), true); 017 swigCMemOwnDerived = cMemoryOwn; 018 swigCPtr = cPtr; 019 } 020 021 protected static long getCPtr(QdFpAmericanEngine 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_QdFpAmericanEngine(swigCPtr); 040 } 041 swigCPtr = 0; 042 } 043 super.delete(); 044 } 045 046 public QdFpAmericanEngine(GeneralizedBlackScholesProcess bsProcess, QdFpIterationScheme iterationScheme, QdFpAmericanEngine.FixedPointEquation fpEquation) { 047 this(QuantLibJNI.new_QdFpAmericanEngine__SWIG_0(GeneralizedBlackScholesProcess.getCPtr(bsProcess), bsProcess, QdFpIterationScheme.getCPtr(iterationScheme), iterationScheme, fpEquation.swigValue()), true); 048 } 049 050 public QdFpAmericanEngine(GeneralizedBlackScholesProcess bsProcess, QdFpIterationScheme iterationScheme) { 051 this(QuantLibJNI.new_QdFpAmericanEngine__SWIG_1(GeneralizedBlackScholesProcess.getCPtr(bsProcess), bsProcess, QdFpIterationScheme.getCPtr(iterationScheme), iterationScheme), true); 052 } 053 054 public QdFpAmericanEngine(GeneralizedBlackScholesProcess bsProcess) { 055 this(QuantLibJNI.new_QdFpAmericanEngine__SWIG_2(GeneralizedBlackScholesProcess.getCPtr(bsProcess), bsProcess), true); 056 } 057 058 public static QdFpIterationScheme fastScheme() { 059 long cPtr = QuantLibJNI.QdFpAmericanEngine_fastScheme(); 060 return (cPtr == 0) ? null : new QdFpIterationScheme(cPtr, true); 061 } 062 063 public static QdFpIterationScheme accurateScheme() { 064 long cPtr = QuantLibJNI.QdFpAmericanEngine_accurateScheme(); 065 return (cPtr == 0) ? null : new QdFpIterationScheme(cPtr, true); 066 } 067 068 public static QdFpIterationScheme highPrecisionScheme() { 069 long cPtr = QuantLibJNI.QdFpAmericanEngine_highPrecisionScheme(); 070 return (cPtr == 0) ? null : new QdFpIterationScheme(cPtr, true); 071 } 072 073 public final static class FixedPointEquation { 074 public final static QdFpAmericanEngine.FixedPointEquation FP_A = new QdFpAmericanEngine.FixedPointEquation("FP_A"); 075 public final static QdFpAmericanEngine.FixedPointEquation FP_B = new QdFpAmericanEngine.FixedPointEquation("FP_B"); 076 public final static QdFpAmericanEngine.FixedPointEquation Auto = new QdFpAmericanEngine.FixedPointEquation("Auto"); 077 078 public final int swigValue() { 079 return swigValue; 080 } 081 082 public String toString() { 083 return swigName; 084 } 085 086 public static FixedPointEquation swigToEnum(int swigValue) { 087 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 088 return swigValues[swigValue]; 089 for (int i = 0; i < swigValues.length; i++) 090 if (swigValues[i].swigValue == swigValue) 091 return swigValues[i]; 092 throw new IllegalArgumentException("No enum " + FixedPointEquation.class + " with value " + swigValue); 093 } 094 095 private FixedPointEquation(String swigName) { 096 this.swigName = swigName; 097 this.swigValue = swigNext++; 098 } 099 100 private FixedPointEquation(String swigName, int swigValue) { 101 this.swigName = swigName; 102 this.swigValue = swigValue; 103 swigNext = swigValue+1; 104 } 105 106 private FixedPointEquation(String swigName, FixedPointEquation swigEnum) { 107 this.swigName = swigName; 108 this.swigValue = swigEnum.swigValue; 109 swigNext = this.swigValue+1; 110 } 111 112 private static FixedPointEquation[] swigValues = { FP_A, FP_B, Auto }; 113 private static int swigNext = 0; 114 private final int swigValue; 115 private final String swigName; 116 } 117 118}