1 45 46 package org.jfree.date; 47 48 57 public class DayAndMonthRule extends AnnualDateRule { 58 59 60 private int dayOfMonth; 61 62 63 private int month; 64 65 68 public DayAndMonthRule() { 69 this(1, MonthConstants.JANUARY); 70 } 71 72 83 public DayAndMonthRule(final int dayOfMonth, final int month) { 84 85 setMonth(month); 87 setDayOfMonth(dayOfMonth); 88 89 } 90 91 96 public int getDayOfMonth() { 97 return this.dayOfMonth; 98 } 99 100 105 public void setDayOfMonth(final int dayOfMonth) { 106 107 if ((dayOfMonth < 1) || (dayOfMonth > SerialDate.LAST_DAY_OF_MONTH[this.month])) { 109 throw new IllegalArgumentException ( 110 "DayAndMonthRule(): dayOfMonth outside valid range."); 111 } 112 113 this.dayOfMonth = dayOfMonth; 115 116 } 117 118 127 public int getMonth() { 128 return this.month; 129 } 130 131 136 public void setMonth(final int month) { 137 138 if (!SerialDate.isValidMonthCode(month)) { 140 throw new IllegalArgumentException ("DayAndMonthRule(): month code not valid."); 141 } 142 143 this.month = month; 145 146 } 147 148 155 public SerialDate getDate(final int yyyy) { 156 return SerialDate.createInstance(this.dayOfMonth, this.month, yyyy); 157 } 158 } 159 | Popular Tags |