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 Index extends Observable implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013  private transient boolean swigCMemOwnDerived;
014
015  protected Index(long cPtr, boolean cMemoryOwn) {
016    super(QuantLibJNI.Index_SWIGSmartPtrUpcast(cPtr), true);
017    swigCMemOwnDerived = cMemoryOwn;
018    swigCPtr = cPtr;
019  }
020
021  protected static long getCPtr(Index obj) {
022    return (obj == null) ? 0 : obj.swigCPtr;
023  }
024
025  protected void swigSetCMemOwn(boolean own) {
026    swigCMemOwnDerived = own;
027    super.swigSetCMemOwn(own);
028  }
029
030  @SuppressWarnings("deprecation")
031  protected void finalize() {
032    delete();
033  }
034
035  public synchronized void delete() {
036    if (swigCPtr != 0) {
037      if (swigCMemOwnDerived) {
038        swigCMemOwnDerived = false;
039        QuantLibJNI.delete_Index(swigCPtr);
040      }
041      swigCPtr = 0;
042    }
043    super.delete();
044  }
045
046  public String name() {
047    return QuantLibJNI.Index_name(swigCPtr, this);
048  }
049
050  public Calendar fixingCalendar() {
051    return new Calendar(QuantLibJNI.Index_fixingCalendar(swigCPtr, this), true);
052  }
053
054  public boolean isValidFixingDate(Date fixingDate) {
055    return QuantLibJNI.Index_isValidFixingDate(swigCPtr, this, Date.getCPtr(fixingDate), fixingDate);
056  }
057
058  public boolean hasHistoricalFixing(Date fixingDate) {
059    return QuantLibJNI.Index_hasHistoricalFixing(swigCPtr, this, Date.getCPtr(fixingDate), fixingDate);
060  }
061
062  public double fixing(Date fixingDate, boolean forecastTodaysFixing) {
063    return QuantLibJNI.Index_fixing__SWIG_0(swigCPtr, this, Date.getCPtr(fixingDate), fixingDate, forecastTodaysFixing);
064  }
065
066  public double fixing(Date fixingDate) {
067    return QuantLibJNI.Index_fixing__SWIG_1(swigCPtr, this, Date.getCPtr(fixingDate), fixingDate);
068  }
069
070  public void addFixing(Date fixingDate, double fixing, boolean forceOverwrite) {
071    QuantLibJNI.Index_addFixing__SWIG_0(swigCPtr, this, Date.getCPtr(fixingDate), fixingDate, fixing, forceOverwrite);
072  }
073
074  public void addFixing(Date fixingDate, double fixing) {
075    QuantLibJNI.Index_addFixing__SWIG_1(swigCPtr, this, Date.getCPtr(fixingDate), fixingDate, fixing);
076  }
077
078  public RealTimeSeries timeSeries() {
079    return new RealTimeSeries(QuantLibJNI.Index_timeSeries(swigCPtr, this), false);
080  }
081
082  public void clearFixings() {
083    QuantLibJNI.Index_clearFixings(swigCPtr, this);
084  }
085
086  public void addFixings(DateVector fixingDates, DoubleVector fixings, boolean forceOverwrite) {
087    QuantLibJNI.Index_addFixings__SWIG_0(swigCPtr, this, DateVector.getCPtr(fixingDates), fixingDates, DoubleVector.getCPtr(fixings), fixings, forceOverwrite);
088  }
089
090  public void addFixings(DateVector fixingDates, DoubleVector fixings) {
091    QuantLibJNI.Index_addFixings__SWIG_1(swigCPtr, this, DateVector.getCPtr(fixingDates), fixingDates, DoubleVector.getCPtr(fixings), fixings);
092  }
093
094  public String toString() {
095    return QuantLibJNI.Index_toString(swigCPtr, this);
096  }
097
098}