gov.usda.gdpc.util
Class Calendar

java.lang.Object
  extended byjava.util.Calendar
      extended byjava.util.GregorianCalendar
          extended bygov.usda.gdpc.util.Calendar
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, java.io.Serializable

public class Calendar
extends java.util.GregorianCalendar
implements java.lang.Comparable

Author:
terryc
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.GregorianCalendar
AD, BC
 
Fields inherited from class java.util.Calendar
AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET
 
Constructor Summary
Calendar()
          Constructs a default Calendar using the current time in the default time zone with the default locale.
Calendar(int year, int month, int date)
          Constructs a Calendar with the given date set in the default time zone with the default locale.
Calendar(int year, int month, int date, int hour, int minute)
          Constructs a Calendar with the given date and time set for the default time zone with the default locale.
Calendar(int year, int month, int date, int hour, int minute, int second)
          Constructs a Calendar with the given date and time set for the default time zone with the default locale.
Calendar(java.util.Locale aLocale)
          Constructs a Calendar based on the current time in the default time zone with the given locale.
Calendar(java.util.TimeZone zone)
          Constructs a Calendar based on the current time in the given time zone with the default locale.
Calendar(java.util.TimeZone zone, java.util.Locale aLocale)
          Constructs a GregorianCalendar based on the current time in the given time zone with the given locale.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 java.lang.String getDateTimeString()
          Returns date and time of this calendar as a string.
 java.lang.String toString()
          Returns string representation of this calendar.
 java.lang.String xmlString()
           
 
Methods inherited from class java.util.GregorianCalendar
add, computeFields, computeTime, 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, complete, get, getAvailableLocales, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, getTimeZone, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, setTimeZone
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Calendar

public Calendar()
Constructs a default Calendar using the current time in the default time zone with the default locale.


Calendar

public Calendar(int year,
                int month,
                int date)
Constructs a Calendar with the given date set in the default time zone with the default locale.


Calendar

public Calendar(int year,
                int month,
                int date,
                int hour,
                int minute)
Constructs a Calendar with the given date and time set for the default time zone with the default locale.


Calendar

public Calendar(int year,
                int month,
                int date,
                int hour,
                int minute,
                int second)
Constructs a Calendar with the given date and time set for the default time zone with the default locale.


Calendar

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


Calendar

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


Calendar

public Calendar(java.util.TimeZone zone,
                java.util.Locale aLocale)
Constructs a GregorianCalendar based on the current time in the given time zone with the given locale.

Method Detail

toString

public java.lang.String toString()
Returns string representation of this calendar.

Returns:
string representation

getDateTimeString

public java.lang.String getDateTimeString()
Returns date and time of this calendar as a string.

Returns:
date and time string

compareTo

public int compareTo(java.lang.Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive. The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.

It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this Object.

xmlString

public java.lang.String xmlString()