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 Schedule implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 protected transient boolean swigCMemOwn; 014 015 protected Schedule(long cPtr, boolean cMemoryOwn) { 016 swigCMemOwn = cMemoryOwn; 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(Schedule obj) { 021 return (obj == null) ? 0 : obj.swigCPtr; 022 } 023 024 protected static long swigRelease(Schedule obj) { 025 long ptr = 0; 026 if (obj != null) { 027 if (!obj.swigCMemOwn) 028 throw new RuntimeException("Cannot release ownership as memory is not owned"); 029 ptr = obj.swigCPtr; 030 obj.swigCMemOwn = false; 031 obj.delete(); 032 } 033 return ptr; 034 } 035 036 @SuppressWarnings("deprecation") 037 protected void finalize() { 038 delete(); 039 } 040 041 public synchronized void delete() { 042 if (swigCPtr != 0) { 043 if (swigCMemOwn) { 044 swigCMemOwn = false; 045 QuantLibJNI.delete_Schedule(swigCPtr); 046 } 047 swigCPtr = 0; 048 } 049 } 050 051 public Schedule(DateVector arg0, Calendar calendar, BusinessDayConvention convention) { 052 this(QuantLibJNI.new_Schedule__SWIG_0(DateVector.getCPtr(arg0), arg0, Calendar.getCPtr(calendar), calendar, convention.swigValue()), true); 053 } 054 055 public Schedule(DateVector arg0, Calendar calendar) { 056 this(QuantLibJNI.new_Schedule__SWIG_1(DateVector.getCPtr(arg0), arg0, Calendar.getCPtr(calendar), calendar), true); 057 } 058 059 public Schedule(DateVector arg0) { 060 this(QuantLibJNI.new_Schedule__SWIG_2(DateVector.getCPtr(arg0), arg0), true); 061 } 062 063 public Schedule(Date effectiveDate, Date terminationDate, Period tenor, Calendar calendar, BusinessDayConvention convention, BusinessDayConvention terminationDateConvention, DateGeneration.Rule rule, boolean endOfMonth, Date firstDate, Date nextToLastDate) { 064 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); 065 } 066 067 public Schedule(Date effectiveDate, Date terminationDate, Period tenor, Calendar calendar, BusinessDayConvention convention, BusinessDayConvention terminationDateConvention, DateGeneration.Rule rule, boolean endOfMonth, Date firstDate) { 068 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); 069 } 070 071 public Schedule(Date effectiveDate, Date terminationDate, Period tenor, Calendar calendar, BusinessDayConvention convention, BusinessDayConvention terminationDateConvention, DateGeneration.Rule rule, boolean endOfMonth) { 072 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); 073 } 074 075 public Schedule() { 076 this(QuantLibJNI.new_Schedule__SWIG_6(), true); 077 } 078 079 public long size() { 080 return QuantLibJNI.Schedule_size(swigCPtr, this); 081 } 082 083 public Date date(long i) { 084 return new Date(QuantLibJNI.Schedule_date(swigCPtr, this, i), true); 085 } 086 087 public Date previousDate(Date refDate) { 088 return new Date(QuantLibJNI.Schedule_previousDate(swigCPtr, this, Date.getCPtr(refDate), refDate), true); 089 } 090 091 public Date nextDate(Date refDate) { 092 return new Date(QuantLibJNI.Schedule_nextDate(swigCPtr, this, Date.getCPtr(refDate), refDate), true); 093 } 094 095 public DateVector dates() { 096 return new DateVector(QuantLibJNI.Schedule_dates(swigCPtr, this), false); 097 } 098 099 public boolean hasIsRegular() { 100 return QuantLibJNI.Schedule_hasIsRegular(swigCPtr, this); 101 } 102 103 public boolean isRegular(long i) { 104 return QuantLibJNI.Schedule_isRegular__SWIG_0(swigCPtr, this, i); 105 } 106 107 public BoolVector isRegular() { 108 return new BoolVector(QuantLibJNI.Schedule_isRegular__SWIG_1(swigCPtr, this), false); 109 } 110 111 public Calendar calendar() { 112 return new Calendar(QuantLibJNI.Schedule_calendar(swigCPtr, this), false); 113 } 114 115 public Date startDate() { 116 return new Date(QuantLibJNI.Schedule_startDate(swigCPtr, this), false); 117 } 118 119 public Date endDate() { 120 return new Date(QuantLibJNI.Schedule_endDate(swigCPtr, this), false); 121 } 122 123 public boolean hasTenor() { 124 return QuantLibJNI.Schedule_hasTenor(swigCPtr, this); 125 } 126 127 public Period tenor() { 128 return new Period(QuantLibJNI.Schedule_tenor(swigCPtr, this), false); 129 } 130 131 public BusinessDayConvention businessDayConvention() { 132 return BusinessDayConvention.swigToEnum(QuantLibJNI.Schedule_businessDayConvention(swigCPtr, this)); 133 } 134 135 public boolean hasTerminationDateBusinessDayConvention() { 136 return QuantLibJNI.Schedule_hasTerminationDateBusinessDayConvention(swigCPtr, this); 137 } 138 139 public BusinessDayConvention terminationDateBusinessDayConvention() { 140 return BusinessDayConvention.swigToEnum(QuantLibJNI.Schedule_terminationDateBusinessDayConvention(swigCPtr, this)); 141 } 142 143 public boolean hasRule() { 144 return QuantLibJNI.Schedule_hasRule(swigCPtr, this); 145 } 146 147 public DateGeneration.Rule rule() { 148 return DateGeneration.Rule.swigToEnum(QuantLibJNI.Schedule_rule(swigCPtr, this)); 149 } 150 151 public boolean hasEndOfMonth() { 152 return QuantLibJNI.Schedule_hasEndOfMonth(swigCPtr, this); 153 } 154 155 public boolean endOfMonth() { 156 return QuantLibJNI.Schedule_endOfMonth(swigCPtr, this); 157 } 158 159 public Schedule after(Date truncationDate) { 160 return new Schedule(QuantLibJNI.Schedule_after(swigCPtr, this, Date.getCPtr(truncationDate), truncationDate), true); 161 } 162 163 public Schedule until(Date truncationDate) { 164 return new Schedule(QuantLibJNI.Schedule_until(swigCPtr, this, Date.getCPtr(truncationDate), truncationDate), true); 165 } 166 167}