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 BlackCalculator implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013  protected transient boolean swigCMemOwn;
014
015  protected BlackCalculator(long cPtr, boolean cMemoryOwn) {
016    swigCMemOwn = cMemoryOwn;
017    swigCPtr = cPtr;
018  }
019
020  protected static long getCPtr(BlackCalculator obj) {
021    return (obj == null) ? 0 : obj.swigCPtr;
022  }
023
024  protected static long swigRelease(BlackCalculator 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_BlackCalculator(swigCPtr);
046      }
047      swigCPtr = 0;
048    }
049  }
050
051  public BlackCalculator(StrikedTypePayoff payoff, double forward, double stdDev, double discount) {
052    this(QuantLibJNI.new_BlackCalculator__SWIG_0(StrikedTypePayoff.getCPtr(payoff), payoff, forward, stdDev, discount), true);
053  }
054
055  public BlackCalculator(StrikedTypePayoff payoff, double forward, double stdDev) {
056    this(QuantLibJNI.new_BlackCalculator__SWIG_1(StrikedTypePayoff.getCPtr(payoff), payoff, forward, stdDev), true);
057  }
058
059  public double value() {
060    return QuantLibJNI.BlackCalculator_value(swigCPtr, this);
061  }
062
063  public double deltaForward() {
064    return QuantLibJNI.BlackCalculator_deltaForward(swigCPtr, this);
065  }
066
067  public double delta(double spot) {
068    return QuantLibJNI.BlackCalculator_delta(swigCPtr, this, spot);
069  }
070
071  public double elasticityForward() {
072    return QuantLibJNI.BlackCalculator_elasticityForward(swigCPtr, this);
073  }
074
075  public double elasticity(double spot) {
076    return QuantLibJNI.BlackCalculator_elasticity(swigCPtr, this, spot);
077  }
078
079  public double gammaForward() {
080    return QuantLibJNI.BlackCalculator_gammaForward(swigCPtr, this);
081  }
082
083  public double gamma(double spot) {
084    return QuantLibJNI.BlackCalculator_gamma(swigCPtr, this, spot);
085  }
086
087  public double theta(double spot, double maturity) {
088    return QuantLibJNI.BlackCalculator_theta(swigCPtr, this, spot, maturity);
089  }
090
091  public double thetaPerDay(double spot, double maturity) {
092    return QuantLibJNI.BlackCalculator_thetaPerDay(swigCPtr, this, spot, maturity);
093  }
094
095  public double vega(double maturity) {
096    return QuantLibJNI.BlackCalculator_vega(swigCPtr, this, maturity);
097  }
098
099  public double rho(double maturity) {
100    return QuantLibJNI.BlackCalculator_rho(swigCPtr, this, maturity);
101  }
102
103  public double dividendRho(double maturity) {
104    return QuantLibJNI.BlackCalculator_dividendRho(swigCPtr, this, maturity);
105  }
106
107  public double itmCashProbability() {
108    return QuantLibJNI.BlackCalculator_itmCashProbability(swigCPtr, this);
109  }
110
111  public double itmAssetProbability() {
112    return QuantLibJNI.BlackCalculator_itmAssetProbability(swigCPtr, this);
113  }
114
115  public double strikeSensitivity() {
116    return QuantLibJNI.BlackCalculator_strikeSensitivity(swigCPtr, this);
117  }
118
119  public double strikeGamma() {
120    return QuantLibJNI.BlackCalculator_strikeGamma(swigCPtr, this);
121  }
122
123  public double alpha() {
124    return QuantLibJNI.BlackCalculator_alpha(swigCPtr, this);
125  }
126
127  public double beta() {
128    return QuantLibJNI.BlackCalculator_beta(swigCPtr, this);
129  }
130
131}