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 ShortRateModelHandle implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013  protected transient boolean swigCMemOwn;
014
015  protected ShortRateModelHandle(long cPtr, boolean cMemoryOwn) {
016    swigCMemOwn = cMemoryOwn;
017    swigCPtr = cPtr;
018  }
019
020  protected static long getCPtr(ShortRateModelHandle obj) {
021    return (obj == null) ? 0 : obj.swigCPtr;
022  }
023
024  protected static long swigRelease(ShortRateModelHandle 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_ShortRateModelHandle(swigCPtr);
046      }
047      swigCPtr = 0;
048    }
049  }
050
051  public ShortRateModelHandle(ShortRateModel arg0) {
052    this(QuantLibJNI.new_ShortRateModelHandle__SWIG_0(ShortRateModel.getCPtr(arg0), arg0), true);
053  }
054
055  public ShortRateModelHandle() {
056    this(QuantLibJNI.new_ShortRateModelHandle__SWIG_1(), true);
057  }
058
059  public ShortRateModel __deref__() {
060    long cPtr = QuantLibJNI.ShortRateModelHandle___deref__(swigCPtr, this);
061    return (cPtr == 0) ? null : new ShortRateModel(cPtr, true);
062  }
063
064  public ShortRateModel currentLink() {
065    long cPtr = QuantLibJNI.ShortRateModelHandle_currentLink(swigCPtr, this);
066    return (cPtr == 0) ? null : new ShortRateModel(cPtr, true);
067  }
068
069  public boolean empty() {
070    return QuantLibJNI.ShortRateModelHandle_empty(swigCPtr, this);
071  }
072
073  public Observable asObservable() {
074    long cPtr = QuantLibJNI.ShortRateModelHandle_asObservable(swigCPtr, this);
075    return (cPtr == 0) ? null : new Observable(cPtr, true);
076  }
077
078  public Array params() {
079    return new Array(QuantLibJNI.ShortRateModelHandle_params(swigCPtr, this), true);
080  }
081
082  public void calibrate(CalibrationHelperVector arg0, OptimizationMethod arg1, EndCriteria arg2, Constraint constraint, DoubleVector weights, BoolVector fixParameters) {
083    QuantLibJNI.ShortRateModelHandle_calibrate__SWIG_0(swigCPtr, this, CalibrationHelperVector.getCPtr(arg0), arg0, OptimizationMethod.getCPtr(arg1), arg1, EndCriteria.getCPtr(arg2), arg2, Constraint.getCPtr(constraint), constraint, DoubleVector.getCPtr(weights), weights, BoolVector.getCPtr(fixParameters), fixParameters);
084  }
085
086  public void calibrate(CalibrationHelperVector arg0, OptimizationMethod arg1, EndCriteria arg2, Constraint constraint, DoubleVector weights) {
087    QuantLibJNI.ShortRateModelHandle_calibrate__SWIG_1(swigCPtr, this, CalibrationHelperVector.getCPtr(arg0), arg0, OptimizationMethod.getCPtr(arg1), arg1, EndCriteria.getCPtr(arg2), arg2, Constraint.getCPtr(constraint), constraint, DoubleVector.getCPtr(weights), weights);
088  }
089
090  public void calibrate(CalibrationHelperVector arg0, OptimizationMethod arg1, EndCriteria arg2, Constraint constraint) {
091    QuantLibJNI.ShortRateModelHandle_calibrate__SWIG_2(swigCPtr, this, CalibrationHelperVector.getCPtr(arg0), arg0, OptimizationMethod.getCPtr(arg1), arg1, EndCriteria.getCPtr(arg2), arg2, Constraint.getCPtr(constraint), constraint);
092  }
093
094  public void calibrate(CalibrationHelperVector arg0, OptimizationMethod arg1, EndCriteria arg2) {
095    QuantLibJNI.ShortRateModelHandle_calibrate__SWIG_3(swigCPtr, this, CalibrationHelperVector.getCPtr(arg0), arg0, OptimizationMethod.getCPtr(arg1), arg1, EndCriteria.getCPtr(arg2), arg2);
096  }
097
098  public void setParams(Array params) {
099    QuantLibJNI.ShortRateModelHandle_setParams(swigCPtr, this, Array.getCPtr(params), params);
100  }
101
102  public double value(Array params, CalibrationHelperVector arg1) {
103    return QuantLibJNI.ShortRateModelHandle_value(swigCPtr, this, Array.getCPtr(params), params, CalibrationHelperVector.getCPtr(arg1), arg1);
104  }
105
106  public Constraint constraint() {
107    long cPtr = QuantLibJNI.ShortRateModelHandle_constraint(swigCPtr, this);
108    return (cPtr == 0) ? null : new Constraint(cPtr, true);
109  }
110
111  public EndCriteria.Type endCriteria() {
112    return EndCriteria.Type.swigToEnum(QuantLibJNI.ShortRateModelHandle_endCriteria(swigCPtr, this));
113  }
114
115  public Array problemValues() {
116    return new Array(QuantLibJNI.ShortRateModelHandle_problemValues(swigCPtr, this), false);
117  }
118
119  public int functionEvaluation() {
120    return QuantLibJNI.ShortRateModelHandle_functionEvaluation(swigCPtr, this);
121  }
122
123}