watch
Class Date

java.lang.Object
  extended by java.util.Date
      extended by watch.Date
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Date>

public class Date
extends java.util.Date

Date model class, providing parsing and formatting. All dates are aligned to midnight time. The public visibility is set for unit tests purpose.

See Also:
Serialized Form

Field Summary
protected static java.util.Locale m_jCurrentLocale
          Current locale.
 
Constructor Summary
Date(Date W_Date)
          Copy constructor (from a Watch date object).
Date(java.util.Date J_Date)
          Copy constructor (from a Java date object).
Date(java.lang.String J_Date)
          Constructor.
 
Method Summary
static int delay(Date W_Date1, Date W_Date2)
          Delay in days between two dates.
 Date nextDay()
          Date incrementation.
 Date prevDay()
          Date decrementation.
static boolean setCurrentLocale(java.util.Locale J_CurrentLocale)
          Current locale setting.
static Date today()
          Today date accessor.
 java.lang.String toString()
          String representation of the date.
static Date zero()
          Zero date accessor.
 
Methods inherited from class java.util.Date
after, before, clone, compareTo, equals, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toLocaleString, UTC
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_jCurrentLocale

protected static java.util.Locale m_jCurrentLocale
Current locale. Default is the system default locale.

Constructor Detail

Date

public Date(java.lang.String J_Date)
Constructor.

Parameters:
J_Date - Date in its string format.

Date

public Date(Date W_Date)
Copy constructor (from a Watch date object).

Parameters:
W_Date - Watch date to copy.

Date

public Date(java.util.Date J_Date)
Copy constructor (from a Java date object).

Parameters:
J_Date - Java date to copy.
Method Detail

setCurrentLocale

public static boolean setCurrentLocale(java.util.Locale J_CurrentLocale)
Current locale setting.

Parameters:
J_CurrentLocale - New current locale. Must not be null.
Returns:
true when success, false otherwise.

toString

public java.lang.String toString()
String representation of the date. Depends on the current locale.

Overrides:
toString in class java.util.Date
Returns:
The string representation of the date.

zero

public static Date zero()
Zero date accessor. The zero date corresponds to the very first date possible (usually Jan 1st 1970).

Returns:
Zero date.

today

public static Date today()
Today date accessor.

Returns:
Date of the day.

nextDay

public Date nextDay()
Date incrementation.

Returns:
The date of the day after.

prevDay

public Date prevDay()
Date decrementation.

Returns:
The date of the day before.

delay

public static int delay(Date W_Date1,
                        Date W_Date2)
Delay in days between two dates.

Parameters:
W_Date1 - First date.
W_Date2 - Second date.
Returns:
Number of days between the two dates. This number can be negative.