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 LinearTsrPricerSettings implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 protected transient boolean swigCMemOwn; 014 015 protected LinearTsrPricerSettings(long cPtr, boolean cMemoryOwn) { 016 swigCMemOwn = cMemoryOwn; 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(LinearTsrPricerSettings obj) { 021 return (obj == null) ? 0 : obj.swigCPtr; 022 } 023 024 protected static long swigRelease(LinearTsrPricerSettings 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_LinearTsrPricerSettings(swigCPtr); 046 } 047 swigCPtr = 0; 048 } 049 } 050 051 public LinearTsrPricerSettings() { 052 this(QuantLibJNI.new_LinearTsrPricerSettings(), true); 053 } 054 055 public LinearTsrPricerSettings withRateBound(double lowerRateBound, double upperRateBound) { 056 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withRateBound__SWIG_0(swigCPtr, this, lowerRateBound, upperRateBound), false); 057 } 058 059 public LinearTsrPricerSettings withRateBound(double lowerRateBound) { 060 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withRateBound__SWIG_1(swigCPtr, this, lowerRateBound), false); 061 } 062 063 public LinearTsrPricerSettings withRateBound() { 064 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withRateBound__SWIG_2(swigCPtr, this), false); 065 } 066 067 public LinearTsrPricerSettings withVegaRatio(double vegaRatio) { 068 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withVegaRatio__SWIG_0(swigCPtr, this, vegaRatio), false); 069 } 070 071 public LinearTsrPricerSettings withVegaRatio() { 072 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withVegaRatio__SWIG_1(swigCPtr, this), false); 073 } 074 075 public LinearTsrPricerSettings withVegaRatio(double vegaRatio, double lowerRateBound, double upperRateBound) { 076 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withVegaRatio__SWIG_2(swigCPtr, this, vegaRatio, lowerRateBound, upperRateBound), false); 077 } 078 079 public LinearTsrPricerSettings withPriceThreshold(double priceThreshold) { 080 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withPriceThreshold__SWIG_0(swigCPtr, this, priceThreshold), false); 081 } 082 083 public LinearTsrPricerSettings withPriceThreshold() { 084 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withPriceThreshold__SWIG_1(swigCPtr, this), false); 085 } 086 087 public LinearTsrPricerSettings withPriceThreshold(double priceThreshold, double lowerRateBound, double upperRateBound) { 088 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withPriceThreshold__SWIG_2(swigCPtr, this, priceThreshold, lowerRateBound, upperRateBound), false); 089 } 090 091 public LinearTsrPricerSettings withBSStdDevs(double stdDevs) { 092 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withBSStdDevs__SWIG_0(swigCPtr, this, stdDevs), false); 093 } 094 095 public LinearTsrPricerSettings withBSStdDevs() { 096 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withBSStdDevs__SWIG_1(swigCPtr, this), false); 097 } 098 099 public LinearTsrPricerSettings withBSStdDevs(double stdDevs, double lowerRateBound, double upperRateBound) { 100 return new LinearTsrPricerSettings(QuantLibJNI.LinearTsrPricerSettings_withBSStdDevs__SWIG_2(swigCPtr, this, stdDevs, lowerRateBound, upperRateBound), false); 101 } 102 103 public final static class Strategy { 104 public final static LinearTsrPricerSettings.Strategy RateBound = new LinearTsrPricerSettings.Strategy("RateBound"); 105 public final static LinearTsrPricerSettings.Strategy VegaRatio = new LinearTsrPricerSettings.Strategy("VegaRatio"); 106 public final static LinearTsrPricerSettings.Strategy PriceThreshold = new LinearTsrPricerSettings.Strategy("PriceThreshold"); 107 public final static LinearTsrPricerSettings.Strategy BSStdDevs = new LinearTsrPricerSettings.Strategy("BSStdDevs"); 108 109 public final int swigValue() { 110 return swigValue; 111 } 112 113 public String toString() { 114 return swigName; 115 } 116 117 public static Strategy swigToEnum(int swigValue) { 118 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 119 return swigValues[swigValue]; 120 for (int i = 0; i < swigValues.length; i++) 121 if (swigValues[i].swigValue == swigValue) 122 return swigValues[i]; 123 throw new IllegalArgumentException("No enum " + Strategy.class + " with value " + swigValue); 124 } 125 126 private Strategy(String swigName) { 127 this.swigName = swigName; 128 this.swigValue = swigNext++; 129 } 130 131 private Strategy(String swigName, int swigValue) { 132 this.swigName = swigName; 133 this.swigValue = swigValue; 134 swigNext = swigValue+1; 135 } 136 137 private Strategy(String swigName, Strategy swigEnum) { 138 this.swigName = swigName; 139 this.swigValue = swigEnum.swigValue; 140 swigNext = this.swigValue+1; 141 } 142 143 private static Strategy[] swigValues = { RateBound, VegaRatio, PriceThreshold, BSStdDevs }; 144 private static int swigNext = 0; 145 private final int swigValue; 146 private final String swigName; 147 } 148 149}