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 ActualActual extends DayCounter implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013
014  protected ActualActual(long cPtr, boolean cMemoryOwn) {
015    super(QuantLibJNI.ActualActual_SWIGUpcast(cPtr), cMemoryOwn);
016    swigCPtr = cPtr;
017  }
018
019  protected static long getCPtr(ActualActual obj) {
020    return (obj == null) ? 0 : obj.swigCPtr;
021  }
022
023  protected static long swigRelease(ActualActual obj) {
024    long ptr = 0;
025    if (obj != null) {
026      if (!obj.swigCMemOwn)
027        throw new RuntimeException("Cannot release ownership as memory is not owned");
028      ptr = obj.swigCPtr;
029      obj.swigCMemOwn = false;
030      obj.delete();
031    }
032    return ptr;
033  }
034
035  @SuppressWarnings("deprecation")
036  protected void finalize() {
037    delete();
038  }
039
040  public synchronized void delete() {
041    if (swigCPtr != 0) {
042      if (swigCMemOwn) {
043        swigCMemOwn = false;
044        QuantLibJNI.delete_ActualActual(swigCPtr);
045      }
046      swigCPtr = 0;
047    }
048    super.delete();
049  }
050
051  public ActualActual(ActualActual.Convention c, Schedule schedule) {
052    this(QuantLibJNI.new_ActualActual__SWIG_0(c.swigValue(), Schedule.getCPtr(schedule), schedule), true);
053  }
054
055  public ActualActual(ActualActual.Convention c) {
056    this(QuantLibJNI.new_ActualActual__SWIG_1(c.swigValue()), true);
057  }
058
059  public final static class Convention {
060    public final static ActualActual.Convention ISMA = new ActualActual.Convention("ISMA");
061    public final static ActualActual.Convention Bond = new ActualActual.Convention("Bond");
062    public final static ActualActual.Convention ISDA = new ActualActual.Convention("ISDA");
063    public final static ActualActual.Convention Historical = new ActualActual.Convention("Historical");
064    public final static ActualActual.Convention Actual365 = new ActualActual.Convention("Actual365");
065    public final static ActualActual.Convention AFB = new ActualActual.Convention("AFB");
066    public final static ActualActual.Convention Euro = new ActualActual.Convention("Euro");
067
068    public final int swigValue() {
069      return swigValue;
070    }
071
072    public String toString() {
073      return swigName;
074    }
075
076    public static Convention swigToEnum(int swigValue) {
077      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
078        return swigValues[swigValue];
079      for (int i = 0; i < swigValues.length; i++)
080        if (swigValues[i].swigValue == swigValue)
081          return swigValues[i];
082      throw new IllegalArgumentException("No enum " + Convention.class + " with value " + swigValue);
083    }
084
085    private Convention(String swigName) {
086      this.swigName = swigName;
087      this.swigValue = swigNext++;
088    }
089
090    private Convention(String swigName, int swigValue) {
091      this.swigName = swigName;
092      this.swigValue = swigValue;
093      swigNext = swigValue+1;
094    }
095
096    private Convention(String swigName, Convention swigEnum) {
097      this.swigName = swigName;
098      this.swigValue = swigEnum.swigValue;
099      swigNext = this.swigValue+1;
100    }
101
102    private static Convention[] swigValues = { ISMA, Bond, ISDA, Historical, Actual365, AFB, Euro };
103    private static int swigNext = 0;
104    private final int swigValue;
105    private final String swigName;
106  }
107
108}