Nixed setHour() and setMinute() as the concensus is that you'll addHour(),

etc. from a midnighted calendar.

Also added at(year, month, day) to the builder so that you can do:

Calendars.in(zone).at(2009, Calendar.JANUARY, 1)


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2624 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2009-08-26 22:35:15 +00:00
parent daad15fb38
commit ef967ef1fd
+8 -11
View File
@@ -66,23 +66,12 @@ public class Calendars
return add(Calendar.DATE, days);
}
/** Sets the {@link Calendar#HOUR_OF_DAY} field to the specified value. This uses a 24-hour
* clock. Midnight is 0. */
public Builder setHour (int hour) {
return set(Calendar.HOUR_OF_DAY, hour);
}
/** Adds the specified value to the {@link Calendar#HOUR_OF_DAY} field. Use negative values
* to subtract. */
public Builder addHours (int hours) {
return add(Calendar.HOUR_OF_DAY, hours);
}
/** Sets the {@link Calendar#MINUTE} field to the specified value. */
public Builder setMinute (int minute) {
return set(Calendar.MINUTE, minute);
}
/** Adds the specified value to the {@link Calendar#MINUTE} field. Use negative values to
* subtract. */
public Builder addMinutes (int minutes) {
@@ -107,6 +96,14 @@ public class Calendars
return this;
}
/** Sets the year, month and day to the specified values and the time to zero millseconds
* after midnight on that date. This mirrors {@link Calendars#at} for when you need e.g. a
* custom timezone: <pre>Calendars.in(zone).at(2009, Calendar.JANUARY, 1)</pre> */
public Builder at (int year, int month, int day) {
_calendar.set(year, month, day);
return zeroTime();
}
/** Zeros out the time fields of this calendar, preserving only the date. */
public Builder zeroTime () {
_calendar.set(Calendar.HOUR_OF_DAY, 0);