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 GFunctionFactory implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013  protected transient boolean swigCMemOwn;
014
015  protected GFunctionFactory(long cPtr, boolean cMemoryOwn) {
016    swigCMemOwn = cMemoryOwn;
017    swigCPtr = cPtr;
018  }
019
020  protected static long getCPtr(GFunctionFactory obj) {
021    return (obj == null) ? 0 : obj.swigCPtr;
022  }
023
024  protected static long swigRelease(GFunctionFactory 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_GFunctionFactory(swigCPtr);
046      }
047      swigCPtr = 0;
048    }
049  }
050
051  public final static class YieldCurveModel {
052    public final static GFunctionFactory.YieldCurveModel Standard = new GFunctionFactory.YieldCurveModel("Standard");
053    public final static GFunctionFactory.YieldCurveModel ExactYield = new GFunctionFactory.YieldCurveModel("ExactYield");
054    public final static GFunctionFactory.YieldCurveModel ParallelShifts = new GFunctionFactory.YieldCurveModel("ParallelShifts");
055    public final static GFunctionFactory.YieldCurveModel NonParallelShifts = new GFunctionFactory.YieldCurveModel("NonParallelShifts");
056
057    public final int swigValue() {
058      return swigValue;
059    }
060
061    public String toString() {
062      return swigName;
063    }
064
065    public static YieldCurveModel swigToEnum(int swigValue) {
066      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
067        return swigValues[swigValue];
068      for (int i = 0; i < swigValues.length; i++)
069        if (swigValues[i].swigValue == swigValue)
070          return swigValues[i];
071      throw new IllegalArgumentException("No enum " + YieldCurveModel.class + " with value " + swigValue);
072    }
073
074    private YieldCurveModel(String swigName) {
075      this.swigName = swigName;
076      this.swigValue = swigNext++;
077    }
078
079    private YieldCurveModel(String swigName, int swigValue) {
080      this.swigName = swigName;
081      this.swigValue = swigValue;
082      swigNext = swigValue+1;
083    }
084
085    private YieldCurveModel(String swigName, YieldCurveModel swigEnum) {
086      this.swigName = swigName;
087      this.swigValue = swigEnum.swigValue;
088      swigNext = this.swigValue+1;
089    }
090
091    private static YieldCurveModel[] swigValues = { Standard, ExactYield, ParallelShifts, NonParallelShifts };
092    private static int swigNext = 0;
093    private final int swigValue;
094    private final String swigName;
095  }
096
097}