|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.chronicj.TimePoint
Based directly on the
Time Point pattern described by Martin Fowler. This class wraps the
standard GregorianCalendarin order to
to simplify date precision. Also, some convenience constructors and methods
are provided.
Since things will break if a non- GregorianCalendar is
supplied, declarations explicitly deal with the concrete class instead of
working with the abstract supertype Calendar.
| Constructor Summary | |
TimePoint(java.util.Date aDate)
Creates a TimePoint using default DatePrecision. |
|
TimePoint(java.util.Date aDate,
org.chronicj.DatePrecision precision)
Creates a TimePoint using the specified DatePrecision. |
|
TimePoint(java.util.GregorianCalendar arg)
Delegates call to TimePoint(GregorianCalendar,
DatePrecision) using constant TimePoint#DEFAULT_PRECISION. |
|
TimePoint(java.util.GregorianCalendar arg,
org.chronicj.DatePrecision precision)
Creates a TimePoint using specified DatePrecision. |
|
TimePoint(int year,
int month)
Convenience constructor allowing the more natural 1-based-index for specifying month. |
|
TimePoint(int year,
int month,
int day)
Convenience constructor allowing the more natural 1-based-index for specifying month. |
|
TimePoint(int year,
int month,
int day,
int hour)
Convenience constructor allowing the more natural 1-based-index for specifying month. |
|
TimePoint(int year,
int month,
int day,
int hour,
int minute)
Convenience constructor allowing the more natural 1-based-index for specifying month. |
|
| Method Summary | |
org.chronicj.TimePoint |
addDays(int arg)
Create a new TimePoint using the current instance plus n days. |
org.chronicj.TimePoint |
addHours(int arg)
Create a new TimePoint using the current instance plus n hours. |
org.chronicj.TimePoint |
addMilliSeconds(int arg)
Create a new TimePoint using the current instance plus n milliseconds. |
org.chronicj.TimePoint |
addMinutes(int arg)
Create a new TimePoint using the current instance plus n minutes. |
org.chronicj.TimePoint |
addMonths(int arg)
Create a new TimePoint using the current instance plus n months. |
org.chronicj.TimePoint |
addSeconds(int arg)
Create a new TimePoint using the current instance plus n seconds. |
org.chronicj.TimePoint |
addYears(int arg)
Create a new TimePoint using the current instance plus n years. |
boolean |
after(org.chronicj.TimePoint arg)
Method to see whether this TimePoint instance occurs after another TimePoint instance. |
boolean |
before(org.chronicj.TimePoint arg)
Method to see whether this TimePoint instance occurs before another TimePoint instance. |
int |
compareTo(java.lang.Object arg)
Compare wrapped GregorianCalendars. |
boolean |
equals(java.lang.Object arg)
Compare wrapped GregorianCalendar s for equality |
java.util.GregorianCalendar |
getCalendar()
Getter method for the wrapped GregorianCalendar. |
org.chronicj.DatePrecision |
getDatePrecision()
Getter method for DatePrecision field. |
int |
getDayOfMonth()
Getter for day of the month. |
int |
getDayOfWeek()
Getter for day of the week. |
int |
getHourOfDay()
Getter for hour of the day (24hr). |
int |
getMilliSeconds()
Getter for milliseconds. |
int |
getMinute()
Getter for minutes. |
int |
getMonth()
Getter for month (not zero-indexed). |
int |
getSeconds()
Getter for seconds. |
java.util.Date |
getTime()
Convenience getter method for getCalendar() |
int |
getYear()
Getter for year. |
int |
getZeroIndexedMonth()
Getter returning the wrapped Calendarmonth which is
zero-indexed. |
int |
hashCode()
|
org.chronicj.TimePoint |
increment(int amount)
Increment this TimePoint using the current internal
DatePrecisionby the number of units specified. |
org.chronicj.TimePoint |
minusDays(int arg)
Create a new TimePoint using the current instance minus n days. |
org.chronicj.TimePoint |
toPrecison(org.chronicj.DatePrecision precision)
Create a new TimePoint using this TimePoint
current value set to the supplied DatePrecision. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TimePoint(int year,
int month,
int day)
year - the yearmonth - the month using 1 to 12, where 1 == January and 12 ==
DECEMBER. NOTE: java.util.Calendar is zero based, this is
not.day - the day of the month using 1 to 31
public TimePoint(int year,
int month)
year - the yearmonth - the month using 1 to 12, where 1 == January and 12 ==
DECEMBER. NOTE: java.util.Calendar is zero based, this is
not.
public TimePoint(int year,
int month,
int day,
int hour)
year - the yearmonth - the month using 1 to 12, where 1 == January and 12 ==
DECEMBER. NOTE: java.util.Calendar is zero based, this is
not.day - the day of the month using 1 to 31hour - the hour of the day using 0 to 24
public TimePoint(int year,
int month,
int day,
int hour,
int minute)
year - the yearmonth - the month using 1 to 12, where 1 == January and 12 ==
DECEMBER. NOTE: java.util.Calendar is zero based, this is
not.day - the day of the month using 1 to 31hour - the hour of the day using 0 to 24minute - the minute of the hour using 0 to 60public TimePoint(java.util.GregorianCalendar arg)
TimePoint(GregorianCalendar,
DatePrecision) using constant TimePoint#DEFAULT_PRECISION.
arg - the GregorianCalendar which will be set using
TimePoint#DEFAULT_PRECISION.public TimePoint(java.util.Date aDate)
aDate - the Date which will be set using TimePoint#DEFAULT_PRECISION.
public TimePoint(java.util.Date aDate,
org.chronicj.DatePrecision precision)
aDate - the Date to be setprecision - the DatePrecision to use
java.lang.NullPointerException - if supplied Date is null
public TimePoint(java.util.GregorianCalendar arg,
org.chronicj.DatePrecision precision)
arg - the GregorianCalendar with the requested date valueprecision - the DatePrecision to use| Method Detail |
public java.util.GregorianCalendar getCalendar()
public org.chronicj.DatePrecision getDatePrecision()
public int getDayOfMonth()
public int getDayOfWeek()
public int getHourOfDay()
public int getMilliSeconds()
public int getMinute()
public int getMonth()
GregorianCalendars.
public int getSeconds()
public java.util.Date getTime()
getCalendar()
public int getYear()
public int getZeroIndexedMonth()
Calendarmonth which is
zero-indexed. Values will be between 0 to 11 (inclusive) for GregorianCalendars.
public org.chronicj.TimePoint addDays(int arg)
arg - number of days to add
public org.chronicj.TimePoint addHours(int arg)
arg - number of hours to add
public org.chronicj.TimePoint addMilliSeconds(int arg)
arg - number of milliseconds to add
public org.chronicj.TimePoint addMinutes(int arg)
arg - number of minutes to add
public org.chronicj.TimePoint addMonths(int arg)
arg - number of months to add
public org.chronicj.TimePoint addSeconds(int arg)
arg - number of seconds to add
public org.chronicj.TimePoint addYears(int arg)
arg - number of years to add
public boolean after(org.chronicj.TimePoint arg)
arg - the TimePoint to check
java.lang.NullPointerException - if argument is nullpublic boolean before(org.chronicj.TimePoint arg)
arg - the TimePoint to check
java.lang.NullPointerException - if argument is nullpublic int compareTo(java.lang.Object arg)
GregorianCalendars.
compareTo in interface java.lang.Comparablearg - Object to compare
public boolean equals(java.lang.Object arg)
GregorianCalendar s for equality
equals in class java.lang.Objectarg - Object to check
public int hashCode()
hashCode in class java.lang.Objectpublic org.chronicj.TimePoint increment(int amount)
TimePoint using the current internal
DatePrecisionby the number of units specified. This is
semantically, equivalent to calling Calendar.add(int, int)with
the first argument being the current TimePoint's DatePrecsion and the
second argument being the supplied positive or negative integer amount.
amount - int number of units to increment by.
public org.chronicj.TimePoint toPrecison(org.chronicj.DatePrecision precision)
TimePoint
current value set to the supplied DatePrecision.
precision - DatePrecision to use when creating the new TimePoint
public org.chronicj.TimePoint minusDays(int arg)
arg - number of days to subtract
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||