orderprocessing
Class CalculationCalendar

java.lang.Object
  |
  +--java.util.Calendar
        |
        +--java.util.GregorianCalendar
              |
              +--orderprocessing.CalculationCalendar
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class CalculationCalendar
extends java.util.GregorianCalendar
implements java.io.Serializable

This class provides an increment function for Gregorian Calendars so that a future date may be easily calculated. It can also tell you which of two dates is earlier by returning the earlier (or later) one to you.

See Also:
Serialized Form

Fields inherited from class java.util.GregorianCalendar
AD, BC
 
Fields inherited from class java.util.Calendar
AM, AM_PM, APRIL, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, FRIDAY, HOUR, HOUR_OF_DAY, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET
 
Constructor Summary
CalculationCalendar()
           
CalculationCalendar(int year, int month, int date)
          Constructs a CalculationCalendar with the given date set in the default time zone with the default locale.
CalculationCalendar(int year, int month, int date, int hour, int minute)
          Constructs a CalculationCalendar with the given date and time set for the default time zone with the default locale.
CalculationCalendar(int year, int month, int date, int hour, int minute, int second)
          Constructs a CalculationCalendar with the given date and time set for the default time zone with the default locale.
CalculationCalendar(java.util.Locale aLocale)
          Constructs a CalculationCalendar based on the current time in the default time zone with the given locale.
CalculationCalendar(java.util.TimeZone zone)
          Constructs a CalculationCalendar based on the current time in the given time zone with the default locale.
CalculationCalendar(java.util.TimeZone zone, java.util.Locale aLocale)
          Constructs a CalculationCalendar based on the current time in the given time zone with the given locale.
 
Method Summary
 CalculationCalendar incrementedBy(int field, int amount)
          Increments a calendar by an amount dependent on the chosen date field
 CalculationCalendar max(CalculationCalendar other)
          Returns the maximum (later) of two dates.
 CalculationCalendar min(CalculationCalendar other)
          Returns the minimum (earlier) of two dates.
 
Methods inherited from class java.util.GregorianCalendar
add, equals, getActualMaximum, getActualMinimum, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, hashCode, isLeapYear, roll, roll, setGregorianChange
 
Methods inherited from class java.util.Calendar
after, before, clear, clear, clone, get, getAvailableLocales, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeZone, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeZone, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CalculationCalendar

public CalculationCalendar()

CalculationCalendar

public CalculationCalendar(java.util.TimeZone zone)
Constructs a CalculationCalendar based on the current time in the given time zone with the default locale.
Parameters:
zone - the given time zone.

CalculationCalendar

public CalculationCalendar(java.util.Locale aLocale)
Constructs a CalculationCalendar based on the current time in the default time zone with the given locale.
Parameters:
aLocale - the given locale.

CalculationCalendar

public CalculationCalendar(java.util.TimeZone zone,
                           java.util.Locale aLocale)
Constructs a CalculationCalendar based on the current time in the given time zone with the given locale.
Parameters:
zone - the given time zone.
aLocale - the given locale.

CalculationCalendar

public CalculationCalendar(int year,
                           int month,
                           int date)
Constructs a CalculationCalendar with the given date set in the default time zone with the default locale.
Parameters:
year - the value used to set the YEAR time field in the calendar.
month - the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DATE time field in the calendar.

CalculationCalendar

public CalculationCalendar(int year,
                           int month,
                           int date,
                           int hour,
                           int minute)
Constructs a CalculationCalendar with the given date and time set for the default time zone with the default locale.
Parameters:
year - the value used to set the YEAR time field in the calendar.
month - the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DATE time field in the calendar.
hour - the value used to set the HOUR_OF_DAY time field in the calendar.
minute - the value used to set the MINUTE time field in the calendar.

CalculationCalendar

public CalculationCalendar(int year,
                           int month,
                           int date,
                           int hour,
                           int minute,
                           int second)
Constructs a CalculationCalendar with the given date and time set for the default time zone with the default locale.
Parameters:
year - the value used to set the YEAR time field in the calendar.
month - the value used to set the MONTH time field in the calendar. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DATE time field in the calendar.
hour - the value used to set the HOUR_OF_DAY time field in the calendar.
minute - the value used to set the MINUTE time field in the calendar.
second - the value used to set the SECOND time field in the calendar.
Method Detail

incrementedBy

public CalculationCalendar incrementedBy(int field,
                                         int amount)
Increments a calendar by an amount dependent on the chosen date field
Parameters:
field - which field should be incremented
amount - the amount to increment "field" by.
Returns:
a new calendar suitably incremented.

max

public CalculationCalendar max(CalculationCalendar other)
Returns the maximum (later) of two dates. If the parameter is null it returns this.
Parameters:
other - a calendar to compare with this.
Returns:
the later of other and this.

min

public CalculationCalendar min(CalculationCalendar other)
Returns the minimum (earlier) of two dates. If the parameter is null it returns this.
Parameters:
other - a calendar to compare with this.
Returns:
the earlier of other and this.