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 IMM implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013  protected transient boolean swigCMemOwn;
014
015  protected IMM(long cPtr, boolean cMemoryOwn) {
016    swigCMemOwn = cMemoryOwn;
017    swigCPtr = cPtr;
018  }
019
020  protected static long getCPtr(IMM obj) {
021    return (obj == null) ? 0 : obj.swigCPtr;
022  }
023
024  protected static long swigRelease(IMM 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_IMM(swigCPtr);
046      }
047      swigCPtr = 0;
048    }
049  }
050
051  public static boolean isIMMdate(Date d, boolean mainCycle) {
052    return QuantLibJNI.IMM_isIMMdate__SWIG_0(Date.getCPtr(d), d, mainCycle);
053  }
054
055  public static boolean isIMMdate(Date d) {
056    return QuantLibJNI.IMM_isIMMdate__SWIG_1(Date.getCPtr(d), d);
057  }
058
059  public static boolean isIMMcode(String code, boolean mainCycle) {
060    return QuantLibJNI.IMM_isIMMcode__SWIG_0(code, mainCycle);
061  }
062
063  public static boolean isIMMcode(String code) {
064    return QuantLibJNI.IMM_isIMMcode__SWIG_1(code);
065  }
066
067  public static String code(Date immDate) {
068    return QuantLibJNI.IMM_code(Date.getCPtr(immDate), immDate);
069  }
070
071  public static Date date(String immCode, Date referenceDate) {
072    return new Date(QuantLibJNI.IMM_date__SWIG_0(immCode, Date.getCPtr(referenceDate), referenceDate), true);
073  }
074
075  public static Date date(String immCode) {
076    return new Date(QuantLibJNI.IMM_date__SWIG_1(immCode), true);
077  }
078
079  public static Date nextDate(Date d, boolean mainCycle) {
080    return new Date(QuantLibJNI.IMM_nextDate__SWIG_0(Date.getCPtr(d), d, mainCycle), true);
081  }
082
083  public static Date nextDate(Date d) {
084    return new Date(QuantLibJNI.IMM_nextDate__SWIG_1(Date.getCPtr(d), d), true);
085  }
086
087  public static Date nextDate() {
088    return new Date(QuantLibJNI.IMM_nextDate__SWIG_2(), true);
089  }
090
091  public static Date nextDate(String immCode, boolean mainCycle, Date referenceDate) {
092    return new Date(QuantLibJNI.IMM_nextDate__SWIG_3(immCode, mainCycle, Date.getCPtr(referenceDate), referenceDate), true);
093  }
094
095  public static Date nextDate(String immCode, boolean mainCycle) {
096    return new Date(QuantLibJNI.IMM_nextDate__SWIG_4(immCode, mainCycle), true);
097  }
098
099  public static Date nextDate(String immCode) {
100    return new Date(QuantLibJNI.IMM_nextDate__SWIG_5(immCode), true);
101  }
102
103  public static String nextCode(Date d, boolean mainCycle) {
104    return QuantLibJNI.IMM_nextCode__SWIG_0(Date.getCPtr(d), d, mainCycle);
105  }
106
107  public static String nextCode(Date d) {
108    return QuantLibJNI.IMM_nextCode__SWIG_1(Date.getCPtr(d), d);
109  }
110
111  public static String nextCode() {
112    return QuantLibJNI.IMM_nextCode__SWIG_2();
113  }
114
115  public static String nextCode(String immCode, boolean mainCycle, Date referenceDate) {
116    return QuantLibJNI.IMM_nextCode__SWIG_3(immCode, mainCycle, Date.getCPtr(referenceDate), referenceDate);
117  }
118
119  public static String nextCode(String immCode, boolean mainCycle) {
120    return QuantLibJNI.IMM_nextCode__SWIG_4(immCode, mainCycle);
121  }
122
123  public static String nextCode(String immCode) {
124    return QuantLibJNI.IMM_nextCode__SWIG_5(immCode);
125  }
126
127  public IMM() {
128    this(QuantLibJNI.new_IMM(), true);
129  }
130
131  public final static class Month {
132    public final static IMM.Month F = new IMM.Month("F", QuantLibJNI.IMM_F_get());
133    public final static IMM.Month G = new IMM.Month("G", QuantLibJNI.IMM_G_get());
134    public final static IMM.Month H = new IMM.Month("H", QuantLibJNI.IMM_H_get());
135    public final static IMM.Month J = new IMM.Month("J", QuantLibJNI.IMM_J_get());
136    public final static IMM.Month K = new IMM.Month("K", QuantLibJNI.IMM_K_get());
137    public final static IMM.Month M = new IMM.Month("M", QuantLibJNI.IMM_M_get());
138    public final static IMM.Month N = new IMM.Month("N", QuantLibJNI.IMM_N_get());
139    public final static IMM.Month Q = new IMM.Month("Q", QuantLibJNI.IMM_Q_get());
140    public final static IMM.Month U = new IMM.Month("U", QuantLibJNI.IMM_U_get());
141    public final static IMM.Month V = new IMM.Month("V", QuantLibJNI.IMM_V_get());
142    public final static IMM.Month X = new IMM.Month("X", QuantLibJNI.IMM_X_get());
143    public final static IMM.Month Z = new IMM.Month("Z", QuantLibJNI.IMM_Z_get());
144
145    public final int swigValue() {
146      return swigValue;
147    }
148
149    public String toString() {
150      return swigName;
151    }
152
153    public static Month swigToEnum(int swigValue) {
154      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
155        return swigValues[swigValue];
156      for (int i = 0; i < swigValues.length; i++)
157        if (swigValues[i].swigValue == swigValue)
158          return swigValues[i];
159      throw new IllegalArgumentException("No enum " + Month.class + " with value " + swigValue);
160    }
161
162    private Month(String swigName) {
163      this.swigName = swigName;
164      this.swigValue = swigNext++;
165    }
166
167    private Month(String swigName, int swigValue) {
168      this.swigName = swigName;
169      this.swigValue = swigValue;
170      swigNext = swigValue+1;
171    }
172
173    private Month(String swigName, Month swigEnum) {
174      this.swigName = swigName;
175      this.swigValue = swigEnum.swigValue;
176      swigNext = this.swigValue+1;
177    }
178
179    private static Month[] swigValues = { F, G, H, J, K, M, N, Q, U, V, X, Z };
180    private static int swigNext = 0;
181    private final int swigValue;
182    private final String swigName;
183  }
184
185}