Calendar Component v5.1
www.calendarcomponent.com

com.imagine.component.calendar.data
Class CalendarDate

java.lang.Object
  extended bycom.imagine.component.calendar.data.CalendarDate

public class CalendarDate
extends java.lang.Object

Stores the (year, month, day of month) data from a Date. It does not store the hours, minutes and seconds.


Constructor Summary
CalendarDate()
          Default constructor for the CalendarDate object.
CalendarDate(java.util.Calendar calendar)
          Constructor for the CalendarDate object.
CalendarDate(java.util.Date date)
          Constructor for the CalendarDate object.
CalendarDate(int year, int month, int dayOfMonth)
          Constructor for the CalendarDate object.
 
Method Summary
 CalendarDate add(int numberOfDays)
          Create a new CalendarDate object which is with the specified number of days difference from the current calendar.
 int compareTo(CalendarDate calendarDate)
          Compare the current CalendarDate with the specified one.
 CalendarDate createCalendarDate(int calendarField, int fieldValue)
          Create a new calendarDate which has the fieldValue for the specified calendarField.
 java.util.Date createDate()
          Create a Date object from the current calendarDate object.
 boolean equals(java.lang.Object obj)
          Overrides the equals function in Object class.
 int getDayOfMonth()
          Get the day of month.
 int getMonth()
          Get the month.
 int getWeekOfMonth()
          Returns the week of month.
 int getWeekOfYear()
          Returns the week of year.
 int getYear()
          Get the year.
 int hashCode()
          Overrides the hashCode function from Object class.
 java.lang.String toString()
          Returns "" for null dates and "yyyy.mm.dd" for non null dates.
 boolean wrapsNullDate()
          Returns true if this calendar wraps a null date.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CalendarDate

public CalendarDate()
Default constructor for the CalendarDate object.


CalendarDate

public CalendarDate(java.util.Date date)
Constructor for the CalendarDate object.

Parameters:
date - The date from which the CalendarDate object is constructed.

CalendarDate

public CalendarDate(java.util.Calendar calendar)
Constructor for the CalendarDate object.

Parameters:
calendar - The calendar from which the CalendarDate object is constructed.

CalendarDate

public CalendarDate(int year,
                    int month,
                    int dayOfMonth)
Constructor for the CalendarDate object.

Parameters:
year - The year of the CalendarDate object.
month - The month of the CalendarDate object.
dayOfMonth - The dayOfMonth of the CalendarDate object.
Method Detail

toString

public java.lang.String toString()
Returns "" for null dates and "yyyy.mm.dd" for non null dates.


equals

public boolean equals(java.lang.Object obj)
Overrides the equals function in Object class.

Returns:
true if the objects are equal.

hashCode

public int hashCode()
Overrides the hashCode function from Object class.

Returns:
The hashcode.

getDayOfMonth

public int getDayOfMonth()
Get the day of month.

Returns:
the day of month.

getMonth

public int getMonth()
Get the month.

Returns:
The month.

getYear

public int getYear()
Get the year.

Returns:
The year.

getWeekOfMonth

public int getWeekOfMonth()
Returns the week of month.

Returns:
The week of month.

getWeekOfYear

public int getWeekOfYear()
Returns the week of year.

Returns:
The week of year.

createDate

public java.util.Date createDate()
Create a Date object from the current calendarDate object.

Returns:
A Date object created from the current calendarDate object.

compareTo

public int compareTo(CalendarDate calendarDate)
Compare the current CalendarDate with the specified one.

Parameters:
calendarDate - The calendarDate tio be compared with the current CalendarDate.
Returns:
-1 if the current CalendarDate is smaller than the specified one.
0 if the current CalendarDate is equal with the specified one.
1 if the current CalendarDate is greater than the specified one.

wrapsNullDate

public boolean wrapsNullDate()
Returns true if this calendar wraps a null date.

Returns:
true if this calendar wraps a null date.

add

public CalendarDate add(int numberOfDays)
Create a new CalendarDate object which is with the specified number of days difference from the current calendar.

Parameters:
numberOfDays -
Returns:
A new CalendarDate object which is with the specified number of days difference from the current calendar.

createCalendarDate

public CalendarDate createCalendarDate(int calendarField,
                                       int fieldValue)
Create a new calendarDate which has the fieldValue for the specified calendarField.

Parameters:
calendarField - The field for which a new value will be assigned.
fieldValue - The field value.
Returns:
A new calendarDate which has the fieldValue for the specified calendarField.

Calendar Component v5.1
www.calendarcomponent.com