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

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

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

  protected void finalize() {
    delete();
  }

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

  public boolean isBusinessDay(Date arg0) {
    return QuantLibJNI.Calendar_isBusinessDay(swigCPtr, Date.getCPtr(arg0));
  }

  public boolean isHoliday(Date arg0) {
    return QuantLibJNI.Calendar_isHoliday(swigCPtr, Date.getCPtr(arg0));
  }

  public boolean isEndOfMonth(Date arg0) {
    return QuantLibJNI.Calendar_isEndOfMonth(swigCPtr, Date.getCPtr(arg0));
  }

  public void addHoliday(Date arg0) {
    QuantLibJNI.Calendar_addHoliday(swigCPtr, Date.getCPtr(arg0));
  }

  public void removeHoliday(Date arg0) {
    QuantLibJNI.Calendar_removeHoliday(swigCPtr, Date.getCPtr(arg0));
  }

  public Date adjust(Date d, BusinessDayConvention convention, Date origin) {
    return new Date(QuantLibJNI.Calendar_adjust__SWIG_0(swigCPtr, Date.getCPtr(d), convention.swigValue(), Date.getCPtr(origin)), true);
  }

  public Date adjust(Date d, BusinessDayConvention convention) {
    return new Date(QuantLibJNI.Calendar_adjust__SWIG_1(swigCPtr, Date.getCPtr(d), convention.swigValue()), true);
  }

  public Date adjust(Date d) {
    return new Date(QuantLibJNI.Calendar_adjust__SWIG_2(swigCPtr, Date.getCPtr(d)), true);
  }

  public Date advance(Date d, int n, TimeUnit unit, BusinessDayConvention convention) {
    return new Date(QuantLibJNI.Calendar_advance__SWIG_0(swigCPtr, Date.getCPtr(d), n, unit.swigValue(), convention.swigValue()), true);
  }

  public Date advance(Date d, int n, TimeUnit unit) {
    return new Date(QuantLibJNI.Calendar_advance__SWIG_1(swigCPtr, Date.getCPtr(d), n, unit.swigValue()), true);
  }

  public Date advance(Date d, Period period, BusinessDayConvention convention) {
    return new Date(QuantLibJNI.Calendar_advance__SWIG_2(swigCPtr, Date.getCPtr(d), Period.getCPtr(period), convention.swigValue()), true);
  }

  public Date advance(Date d, Period period) {
    return new Date(QuantLibJNI.Calendar_advance__SWIG_3(swigCPtr, Date.getCPtr(d), Period.getCPtr(period)), true);
  }

  public String toString() {
    return QuantLibJNI.Calendar_toString(swigCPtr);
  }

  public boolean equals(Calendar other) {
    return QuantLibJNI.Calendar_equals(swigCPtr, Calendar.getCPtr(other));
  }

  public boolean unEquals(Calendar other) {
    return QuantLibJNI.Calendar_unEquals(swigCPtr, Calendar.getCPtr(other));
  }

}
