/** * Returns the date, given the year. * * @param yyyy the year. * * @return the date generated by this rule for the specified year (null permitted). */ public SerialDate getDate(final int yyyy) { return SerialDate.createInstance(this.dayOfMonth, this.month, yyyy); } }
/** * Returns the date, given the year. * * @param yyyy the year. * * @return the date generated by this rule for the specified year (null permitted). */ public SerialDate getDate(final int yyyy) { return SerialDate.createInstance(this.dayOfMonth, this.month, yyyy); } }
/** * Returns the date, given the year. * * @param yyyy the year. * * @return the date generated by this rule for the specified year (null permitted). */ public SerialDate getDate(final int yyyy) { return SerialDate.createInstance(this.dayOfMonth, this.month, yyyy); } }
/** * Constructs a new date chooser panel, using today's date as the initial selection. */ public SerialDateChooserPanel() { this(SerialDate.createInstance(new Date()), false, DEFAULT_DATE_BUTTON_COLOR, DEFAULT_MONTH_BUTTON_COLOR); }
/** * Constructs a new date chooser panel, using today's date as the initial selection. */ public SerialDateChooserPanel() { this(SerialDate.createInstance(new Date()), false, DEFAULT_DATE_BUTTON_COLOR, DEFAULT_MONTH_BUTTON_COLOR); }
/** * Constructs a new date chooser panel, using today's date as the initial selection. */ public SerialDateChooserPanel() { this(SerialDate.createInstance(new Date()), false, DEFAULT_DATE_BUTTON_COLOR, DEFAULT_MONTH_BUTTON_COLOR); }
/** * Constructs a new one day time period. * * @param day the day-of-the-month. * @param month the month (1 to 12). * @param year the year (1900 <= year <= 9999). */ public Day(int day, int month, int year) { this.serialDate = SerialDate.createInstance(day, month, year); peg(Calendar.getInstance()); }
/** * Creates a new date by adding the specified number of days to the base * date. * * @param days the number of days to add (can be negative). * @param base the base date. * * @return a new date. */ public static SerialDate addDays(final int days, final SerialDate base) { final int serialDayNumber = base.toSerial() + days; return SerialDate.createInstance(serialDayNumber); }
/** * Creates a new date by adding the specified number of days to the base * date. * * @param days the number of days to add (can be negative). * @param base the base date. * * @return a new date. */ public static SerialDate addDays(final int days, final SerialDate base) { final int serialDayNumber = base.toSerial() + days; return SerialDate.createInstance(serialDayNumber); }
/** * Creates a new date by adding the specified number of days to the base * date. * * @param days the number of days to add (can be negative). * @param base the base date. * * @return a new date. */ public static SerialDate addDays(final int days, final SerialDate base) { final int serialDayNumber = base.toSerial() + days; return SerialDate.createInstance(serialDayNumber); }
/** * Returns the day preceding this one. * * @return The day preceding this one. */ public RegularTimePeriod previous() { Day result; int serial = this.serialDate.toSerial(); if (serial > SerialDate.SERIAL_LOWER_BOUND) { SerialDate yesterday = SerialDate.createInstance(serial - 1); return new Day(yesterday); } else { result = null; } return result; }
/** * Returns the day following this one, or <code>null</code> if some limit * has been reached. * * @return The day following this one, or <code>null</code> if some limit * has been reached. */ public RegularTimePeriod next() { Day result; int serial = this.serialDate.toSerial(); if (serial < SerialDate.SERIAL_UPPER_BOUND) { SerialDate tomorrow = SerialDate.createInstance(serial + 1); return new Day(tomorrow); } else { result = null; } return result; }
/** * Creates a new date by adding the specified number of years to the base * date. * * @param years the number of years to add (can be negative). * @param base the base date. * * @return A new date. */ public static SerialDate addYears(final int years, final SerialDate base) { final int baseY = base.getYYYY(); final int baseM = base.getMonth(); final int baseD = base.getDayOfMonth(); final int targetY = baseY + years; final int targetD = Math.min( baseD, SerialDate.lastDayOfMonth(baseM, targetY) ); return SerialDate.createInstance(targetD, baseM, targetY); }
/** * Creates a new date by adding the specified number of years to the base * date. * * @param years the number of years to add (can be negative). * @param base the base date. * * @return A new date. */ public static SerialDate addYears(final int years, final SerialDate base) { final int baseY = base.getYYYY(); final int baseM = base.getMonth(); final int baseD = base.getDayOfMonth(); final int targetY = baseY + years; final int targetD = Math.min( baseD, SerialDate.lastDayOfMonth(baseM, targetY) ); return SerialDate.createInstance(targetD, baseM, targetY); }
/** * Rolls the date forward to the last day of the month. * * @param base the base date. * * @return a new serial date. */ public SerialDate getEndOfCurrentMonth(final SerialDate base) { final int last = SerialDate.lastDayOfMonth( base.getMonth(), base.getYYYY() ); return SerialDate.createInstance(last, base.getMonth(), base.getYYYY()); }
/** * Rolls the date forward to the last day of the month. * * @param base the base date. * * @return a new serial date. */ public SerialDate getEndOfCurrentMonth(final SerialDate base) { final int last = SerialDate.lastDayOfMonth( base.getMonth(), base.getYYYY() ); return SerialDate.createInstance(last, base.getMonth(), base.getYYYY()); }
/** * Rolls the date forward to the last day of the month. * * @param base the base date. * * @return a new serial date. */ public SerialDate getEndOfCurrentMonth(final SerialDate base) { final int last = SerialDate.lastDayOfMonth( base.getMonth(), base.getYYYY() ); return SerialDate.createInstance(last, base.getMonth(), base.getYYYY()); }
/** * Returns the first date that is visible in the grid. This should always be in the month * preceding the month of the selected date. * * @return the first visible date. */ protected SerialDate getFirstVisibleDate() { SerialDate result = SerialDate.createInstance(1, this.date.getMonth(), this.date.getYYYY()); result = SerialDate.addDays(-1, result); while (result.getDayOfWeek() != getFirstDayOfWeek()) { result = SerialDate.addDays(-1, result); } return result; }
/** * Returns the first date that is visible in the grid. This should always be in the month * preceding the month of the selected date. * * @return the first visible date. */ protected SerialDate getFirstVisibleDate() { SerialDate result = SerialDate.createInstance(1, this.date.getMonth(), this.date.getYYYY()); result = SerialDate.addDays(-1, result); while (result.getDayOfWeek() != getFirstDayOfWeek()) { result = SerialDate.addDays(-1, result); } return result; }
/** * Returns the first date that is visible in the grid. This should always be in the month * preceding the month of the selected date. * * @return the first visible date. */ protected SerialDate getFirstVisibleDate() { SerialDate result = SerialDate.createInstance(1, this.date.getMonth(), this.date.getYYYY()); result = SerialDate.addDays(-1, result); while (result.getDayOfWeek() != getFirstDayOfWeek()) { result = SerialDate.addDays(-1, result); } return result; }