/** * Returns the hour. * * @return The hour (never {@code null}). */ public Hour getHour() { return new Hour(this.hour, this.day); }
/** * Constructs a new Minute. * * @param minute the minute (0 to 59). * @param hour the hour (<code>null</code> not permitted). */ public Minute(int minute, Hour hour) { if (hour == null) { throw new IllegalArgumentException("Null 'hour' argument."); } this.minute = (byte) minute; this.hour = (byte) hour.getHour(); this.day = hour.getDay(); peg(Calendar.getInstance()); }
/** * Returns a string representation of this instance, for debugging * purposes. * * @return A string. */ @Override public String toString() { return "[" + this.hour + "," + getDayOfMonth() + "/" + getMonth() + "/" + getYear() + "]"; }
/** * Recalculates the start date/time and end date/time for this time period * relative to the supplied calendar (which incorporates a time zone). * * @param calendar the calendar (<code>null</code> not permitted). * * @since 1.0.3 */ public void peg(Calendar calendar) { this.firstMillisecond = getFirstMillisecond(calendar); this.lastMillisecond = getLastMillisecond(calendar); }
result = getHour().compareTo(m.getHour()); if (result == 0) { result = this.minute - m.getMinute();
/** * Recalculates the start date/time and end date/time for this time period * relative to the supplied calendar (which incorporates a time zone). * * @param calendar the calendar ({@code null} not permitted). * * @since 1.0.3 */ @Override public void peg(Calendar calendar) { this.firstMillisecond = getFirstMillisecond(calendar); this.lastMillisecond = getLastMillisecond(calendar); }
result = getHour().compareTo(m.getHour()); if (result == 0) { result = this.minute - m.getMinute();
/** * Returns the hour. * * @return The hour (never <code>null</code>). */ public Hour getHour() { return new Hour(this.hour, this.day); }
/** * Returns a string representation of this instance, for debugging * purposes. * * @return A string. */ public String toString() { return "[" + this.hour + "," + getDayOfMonth() + "/" + getMonth() + "/" + getYear() + "]"; }
/** * Constructs a new Minute. * * @param minute the minute (0 to 59). * @param hour the hour ({@code null} not permitted). */ public Minute(int minute, Hour hour) { Args.nullNotPermitted(hour, "hour"); this.minute = (byte) minute; this.hour = (byte) hour.getHour(); this.day = hour.getDay(); peg(Calendar.getInstance()); }
/** * Returns the minute. * * @return The minute (never {@code null}). */ public Minute getMinute() { return new Minute(this.minute, new Hour(this.hour, this.day)); }
/** * Returns the minute. * * @return The minute (never <code>null</code>). */ public Minute getMinute() { return new Minute(this.minute, new Hour(this.hour, this.day)); }
/** * Returns the hour following this one. * * @return The hour following this one. */ @Override public RegularTimePeriod next() { Hour result; if (this.hour != LAST_HOUR_IN_DAY) { result = new Hour(this.hour + 1, this.day); } else { // we are at the last hour in the day... Day nextDay = (Day) this.day.next(); if (nextDay != null) { result = new Hour(FIRST_HOUR_IN_DAY, nextDay); } else { result = null; } } return result; }
/** * Returns the hour preceding this one. * * @return The hour preceding this one. */ @Override public RegularTimePeriod previous() { Hour result; if (this.hour != FIRST_HOUR_IN_DAY) { result = new Hour(this.hour - 1, this.day); } else { // we are at the first hour in the day... Day prevDay = (Day) this.day.previous(); if (prevDay != null) { result = new Hour(LAST_HOUR_IN_DAY, prevDay); } else { result = null; } } return result; }
/** * Returns the hour preceding this one. * * @return The hour preceding this one. */ public RegularTimePeriod previous() { Hour result; if (this.hour != FIRST_HOUR_IN_DAY) { result = new Hour(this.hour - 1, this.day); } else { // we are at the first hour in the day... Day prevDay = (Day) this.day.previous(); if (prevDay != null) { result = new Hour(LAST_HOUR_IN_DAY, prevDay); } else { result = null; } } return result; }
/** * Returns the hour following this one. * * @return The hour following this one. */ public RegularTimePeriod next() { Hour result; if (this.hour != LAST_HOUR_IN_DAY) { result = new Hour(this.hour + 1, this.day); } else { // we are at the last hour in the day... Day nextDay = (Day) this.day.next(); if (nextDay != null) { result = new Hour(FIRST_HOUR_IN_DAY, nextDay); } else { result = null; } } return result; }