/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * 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 Schedule {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

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

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

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

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

  public Schedule(DateVector arg0, Calendar calendar, BusinessDayConvention convention) {
    this(QuantLibJNI.new_Schedule__SWIG_0(DateVector.getCPtr(arg0), arg0, Calendar.getCPtr(calendar), calendar, convention.swigValue()), true);
  }

  public Schedule(DateVector arg0, Calendar calendar) {
    this(QuantLibJNI.new_Schedule__SWIG_1(DateVector.getCPtr(arg0), arg0, Calendar.getCPtr(calendar), calendar), true);
  }

  public Schedule(DateVector arg0) {
    this(QuantLibJNI.new_Schedule__SWIG_2(DateVector.getCPtr(arg0), arg0), true);
  }

  public Schedule(Date effectiveDate, Date terminationDate, Period tenor, Calendar calendar, BusinessDayConvention convention, BusinessDayConvention terminationDateConvention, DateGeneration.Rule rule, boolean endOfMonth, Date firstDate, Date nextToLastDate) {
    this(QuantLibJNI.new_Schedule__SWIG_3(Date.getCPtr(effectiveDate), effectiveDate, Date.getCPtr(terminationDate), terminationDate, Period.getCPtr(tenor), tenor, Calendar.getCPtr(calendar), calendar, convention.swigValue(), terminationDateConvention.swigValue(), rule.swigValue(), endOfMonth, Date.getCPtr(firstDate), firstDate, Date.getCPtr(nextToLastDate), nextToLastDate), true);
  }

  public Schedule(Date effectiveDate, Date terminationDate, Period tenor, Calendar calendar, BusinessDayConvention convention, BusinessDayConvention terminationDateConvention, DateGeneration.Rule rule, boolean endOfMonth, Date firstDate) {
    this(QuantLibJNI.new_Schedule__SWIG_4(Date.getCPtr(effectiveDate), effectiveDate, Date.getCPtr(terminationDate), terminationDate, Period.getCPtr(tenor), tenor, Calendar.getCPtr(calendar), calendar, convention.swigValue(), terminationDateConvention.swigValue(), rule.swigValue(), endOfMonth, Date.getCPtr(firstDate), firstDate), true);
  }

  public Schedule(Date effectiveDate, Date terminationDate, Period tenor, Calendar calendar, BusinessDayConvention convention, BusinessDayConvention terminationDateConvention, DateGeneration.Rule rule, boolean endOfMonth) {
    this(QuantLibJNI.new_Schedule__SWIG_5(Date.getCPtr(effectiveDate), effectiveDate, Date.getCPtr(terminationDate), terminationDate, Period.getCPtr(tenor), tenor, Calendar.getCPtr(calendar), calendar, convention.swigValue(), terminationDateConvention.swigValue(), rule.swigValue(), endOfMonth), true);
  }

  public Schedule() {
    this(QuantLibJNI.new_Schedule__SWIG_6(), true);
  }

  public long size() {
    return QuantLibJNI.Schedule_size(swigCPtr, this);
  }

  public Date date(long i) {
    return new Date(QuantLibJNI.Schedule_date(swigCPtr, this, i), true);
  }

  public Date previousDate(Date refDate) {
    return new Date(QuantLibJNI.Schedule_previousDate(swigCPtr, this, Date.getCPtr(refDate), refDate), true);
  }

  public Date nextDate(Date refDate) {
    return new Date(QuantLibJNI.Schedule_nextDate(swigCPtr, this, Date.getCPtr(refDate), refDate), true);
  }

  public boolean hasIsRegular() {
    return QuantLibJNI.Schedule_hasIsRegular(swigCPtr, this);
  }

  public boolean isRegular(long i) {
    return QuantLibJNI.Schedule_isRegular__SWIG_0(swigCPtr, this, i);
  }

  public BoolVector isRegular() {
    return new BoolVector(QuantLibJNI.Schedule_isRegular__SWIG_1(swigCPtr, this), false);
  }

  public Calendar calendar() {
    return new Calendar(QuantLibJNI.Schedule_calendar(swigCPtr, this), false);
  }

  public Date startDate() {
    return new Date(QuantLibJNI.Schedule_startDate(swigCPtr, this), false);
  }

  public Date endDate() {
    return new Date(QuantLibJNI.Schedule_endDate(swigCPtr, this), false);
  }

  public boolean hasTenor() {
    return QuantLibJNI.Schedule_hasTenor(swigCPtr, this);
  }

  public Period tenor() {
    return new Period(QuantLibJNI.Schedule_tenor(swigCPtr, this), false);
  }

  public BusinessDayConvention businessDayConvention() {
    return BusinessDayConvention.swigToEnum(QuantLibJNI.Schedule_businessDayConvention(swigCPtr, this));
  }

  public boolean hasTerminationDateBusinessDayConvention() {
    return QuantLibJNI.Schedule_hasTerminationDateBusinessDayConvention(swigCPtr, this);
  }

  public BusinessDayConvention terminationDateBusinessDayConvention() {
    return BusinessDayConvention.swigToEnum(QuantLibJNI.Schedule_terminationDateBusinessDayConvention(swigCPtr, this));
  }

  public boolean hasRule() {
    return QuantLibJNI.Schedule_hasRule(swigCPtr, this);
  }

  public DateGeneration.Rule rule() {
    return DateGeneration.Rule.swigToEnum(QuantLibJNI.Schedule_rule(swigCPtr, this));
  }

  public boolean hasEndOfMonth() {
    return QuantLibJNI.Schedule_hasEndOfMonth(swigCPtr, this);
  }

  public boolean endOfMonth() {
    return QuantLibJNI.Schedule_endOfMonth(swigCPtr, this);
  }

  public Schedule until(Date truncationDate) {
    return new Schedule(QuantLibJNI.Schedule_until(swigCPtr, this, Date.getCPtr(truncationDate), truncationDate), true);
  }

}
