/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (https://www.swig.org).
 * Version 4.1.1
 *
 * Do not make changes to this file unless you know what you are doing - modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.quantlib;

public class CurveState {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected CurveState(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(CurveState obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected static long swigRelease(CurveState obj) {
    long ptr = 0;
    if (obj != null) {
      if (!obj.swigCMemOwn)
        throw new RuntimeException("Cannot release ownership as memory is not owned");
      ptr = obj.swigCPtr;
      obj.swigCMemOwn = false;
      obj.delete();
    }
    return ptr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        QuantLibJNI.delete_CurveState(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public long numberOfRates() {
    return QuantLibJNI.CurveState_numberOfRates(swigCPtr, this);
  }

  public DoubleVector rateTimes() {
    return new DoubleVector(QuantLibJNI.CurveState_rateTimes(swigCPtr, this), false);
  }

  public DoubleVector rateTaus() {
    return new DoubleVector(QuantLibJNI.CurveState_rateTaus(swigCPtr, this), false);
  }

  public double discountRatio(long i, long j) {
    return QuantLibJNI.CurveState_discountRatio(swigCPtr, this, i, j);
  }

  public double forwardRate(long i) {
    return QuantLibJNI.CurveState_forwardRate(swigCPtr, this, i);
  }

  public double coterminalSwapAnnuity(long numeraire, long i) {
    return QuantLibJNI.CurveState_coterminalSwapAnnuity(swigCPtr, this, numeraire, i);
  }

  public double coterminalSwapRate(long i) {
    return QuantLibJNI.CurveState_coterminalSwapRate(swigCPtr, this, i);
  }

  public double cmSwapAnnuity(long numeraire, long i, long spanningForwards) {
    return QuantLibJNI.CurveState_cmSwapAnnuity(swigCPtr, this, numeraire, i, spanningForwards);
  }

  public double cmSwapRate(long i, long spanningForwards) {
    return QuantLibJNI.CurveState_cmSwapRate(swigCPtr, this, i, spanningForwards);
  }

  public DoubleVector forwardRates() {
    return new DoubleVector(QuantLibJNI.CurveState_forwardRates(swigCPtr, this), false);
  }

  public DoubleVector coterminalSwapRates() {
    return new DoubleVector(QuantLibJNI.CurveState_coterminalSwapRates(swigCPtr, this), false);
  }

  public DoubleVector cmSwapRates(long spanningForwards) {
    return new DoubleVector(QuantLibJNI.CurveState_cmSwapRates(swigCPtr, this, spanningForwards), false);
  }

  public double swapRate(long begin, long end) {
    return QuantLibJNI.CurveState_swapRate(swigCPtr, this, begin, end);
  }

}
