formatter
Class Date

java.lang.Object
  extended by formatter.Date

public class Date
extends java.lang.Object

Stores the year, month, date (day of the month), and day (name of the day of the week). The distinction between the "date" and the "day" are that the date is a number from 1 to 31 and is relative to the month, whereas the day is a String that correlates to the day within the week, e.g. "Tuesday" and "Friday".


Constructor Summary
Date(int y, int m, int dt)
          Stores the date represented by the year, month, and date parameters.
Date(int y, int m, int dt, java.lang.String dy)
          Stores the date represented by the year, month, and date parameters.
 
Method Summary
 boolean after(Date that)
          Determines if this date is after the passed date.
 boolean before(Date that)
          Determines if this date is before the passed date.
static java.lang.String dayToFullName(java.lang.String day)
          Converts the smaller section of a day-of-the-week's name to the full section.
 boolean equals(Date that)
          Determines if the passed date object is equivalent to this one.
 boolean equals(java.lang.Object that)
          Determines if the passed date object is equivalent to this one.
 int getDate()
          Returns the day of the month.
 java.lang.String getDay()
          Returns the day of the week.
 int getMonth()
          Returns the month of th year, e.g.
 int getYear()
          Returns the year.
static int monthToInt(java.lang.String month)
          Returns the number corresponding to the month in the year.
 java.lang.String toString()
          Returns a String representation of this Date.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Date

public Date(int y,
            int m,
            int dt)
Stores the date represented by the year, month, and date parameters. Computes which date of the week this date represents.

Parameters:
y - Year of the date.
m - Month of the date.
dt - Date of the date -- the day-portion.

Date

public Date(int y,
            int m,
            int dt,
            java.lang.String dy)
Stores the date represented by the year, month, and date parameters.

Parameters:
y - Year of the date.
m - Month of the date.
dt - Date of the date -- the day-portion.
dy - The day of the week.
Method Detail

dayToFullName

public static java.lang.String dayToFullName(java.lang.String day)
Converts the smaller section of a day-of-the-week's name to the full section.

Parameters:
day - The beginning of the day of the week. Must be at least 2 characters.
Returns:
The full name of the day of the week. E.g. "Wednesday"
Throws:
java.lang.IllegalArgumentException - If the parameter is not a day of the week.

monthToInt

public static int monthToInt(java.lang.String month)
Returns the number corresponding to the month in the year. E.g. March is 3, December is 12.

Parameters:
month - The name of the month. Must be at least 3 characters long.
Returns:
The number corresponding to the month in the year.
Throws:
java.lang.IllegalArgumentException - If the string is not a valid month.

getYear

public int getYear()
Returns the year. E.g. "2005"

Returns:
The year.

getMonth

public int getMonth()
Returns the month of th year, e.g. "3" for March.

Returns:
The month.

getDate

public int getDate()
Returns the day of the month. E.g. the 4th.

Returns:
The date.

getDay

public java.lang.String getDay()
Returns the day of the week. E.g. "Wednesday"

Returns:
The day.

toString

public java.lang.String toString()
Returns a String representation of this Date.

Overrides:
toString in class java.lang.Object
Returns:
String representation.

equals

public boolean equals(java.lang.Object that)
Determines if the passed date object is equivalent to this one.

Overrides:
equals in class java.lang.Object
Parameters:
that - The other date to compare this with.
Returns:
Returns true if the dates are the same and false otherwise.

equals

public boolean equals(Date that)
Determines if the passed date object is equivalent to this one.

Parameters:
that - The other date to compare this with.
Returns:
Returns true if the dates are the same and false otherwise.

after

public boolean after(Date that)
Determines if this date is after the passed date.

Parameters:
that - The Date to compare against.
Returns:
true if this date is after that date.

before

public boolean before(Date that)
Determines if this date is before the passed date.

Parameters:
that - The Date to compare against.
Returns:
true if this date is before that date.