|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.util.Date
com.davisor.data.TimestampData
com.davisor.data.CalendarData
CalendarData represents a calendar value. A calendar value represents either an absolute date, like first of May, 1999, or a relative period of time, like "five years and two months" or "three weeks and twelve hours, six minutes".
This class extends TimestampData with an internal calendar
object that is kept in sync with the underlying timestamp value.
This calenderical view affects in particular time arithmetics.
getCalendar(),
CalendarFieldData,
CalendarType,
DateData,
TimeData,
TimestampData,
Serialized Form| Field Summary | |
protected java.util.Calendar |
M_calendar
Calendar value. |
| Fields inherited from class com.davisor.data.TimestampData |
M_type, NaT |
| Constructor Summary | |
CalendarData()
Creates a new calendar data object with the current time and default type. |
|
CalendarData(java.util.Calendar calendar)
Creates a calendar data value from the default type and given calendar value. |
|
CalendarData(CalendarData cd,
boolean deep)
Deep or shallow copy constructor. |
|
CalendarData(CalendarField field)
Creates a calendar data value from the default type and given calendar field value. |
|
CalendarData(CalendarField field1,
CalendarField field2)
Creates a calendar data value from the default type and given calendar field values. |
|
CalendarData(DateFormatType type)
Creates a new calendar data object with the current time and given type. |
|
CalendarData(DateFormatType type,
java.util.Calendar calendar)
Creates a calendar data value from a given type and calendar value. |
|
CalendarData(DateFormatType type,
CalendarData calendarData)
Creates a calendar data value from a given type and calendar value. |
|
CalendarData(DateFormatType type,
CalendarField field)
Creates a calendar data value from a given type and calendar field value. |
|
CalendarData(DateFormatType type,
CalendarField field1,
CalendarField field2)
Creates a calendar data value from a given type and calendar field value. |
|
CalendarData(DateFormatType type,
CalendarFieldData cfd)
Creates a calendar data value from a given type and calendar value. |
|
CalendarData(DateFormatType type,
java.util.Date date)
Creates a calendar data value from a given type and date. |
|
CalendarData(DateFormatType type,
long milliseconds)
Creates a calendar data value from a given type and date. |
|
CalendarData(DateFormatType type,
java.lang.String stringValue,
java.text.ParsePosition status)
Creates a calendar data value from a string value. |
|
| Method Summary | |
void |
add(int field,
int amount)
Adds given amount of time to current calendar value. |
DataValue |
ceil(java.util.Date precision)
Quantizes the current value up to an even value within given date precision. |
java.util.Calendar |
createCalendar()
Creates a new calendar set to the moment of time this object currently represents. |
com.davisor.core.Dupable |
dup()
Makes a deep copy of this object. |
DataValue |
floor(java.util.Date precision)
Quantizes the current value down to an even value within given precision. |
int |
get(int field)
Gets the value for a given time field. |
int |
getActualMaximum(int field)
Gets the actual maximum value for a given time field, given the current date. |
int |
getActualMinimum(int field)
Gets the actual minimum value for a given time field, given the current date. |
java.util.Calendar |
getCalendar()
Gets a reference to the underlying calendar object. |
int |
getGreatestMinimum(int field)
Gets the greatest minimum value for a given time field. |
int |
getLeastMaximum(int field)
Gets the least maximum value for a given time field. |
int |
getMaximum(int field)
Gets the maximum value for a given time field, given the current date. |
int |
getMinimum(int field)
Gets the minimum value for a given time field, given the current date. |
boolean |
isNull()
Tests if this data object value is undetermined. |
void |
roll(int field,
int amount)
Rolls given field a given amount of time. |
void |
setTime(long time)
Sets the duration of this calendar date in milliseconds. |
void |
setTimeZone(java.util.TimeZone value)
Sets calendar time zone. |
| Methods inherited from class com.davisor.data.TimestampData |
abs, add, ceil, compareTo, compareTo, deinterpolate, div, floor, getFormat, getType, initTime, interpolate, max, min, mul, negate, setTime, setValue, sub, toStatement, toString, toXML, unit |
| 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, setYear, toGMTString, toLocaleString, UTC |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.util.Calendar M_calendar
| Constructor Detail |
public CalendarData()
DateFormatType.createCalendar(java.util.Date)
public CalendarData(CalendarData cd,
boolean deep)
cd - source calendar data (may be null)deep - determines if the copying is deep or shallowpublic CalendarData(DateFormatType type)
type - custom calendar typepublic CalendarData(java.util.Calendar calendar)
calendar - calendarpublic CalendarData(CalendarField field)
field - calendar field
public CalendarData(CalendarField field1,
CalendarField field2)
field1 - calendar fieldfield2 - calendar field
public CalendarData(DateFormatType type,
CalendarField field)
type - calendar typefield - calendar field
public CalendarData(DateFormatType type,
CalendarField field1,
CalendarField field2)
type - calendar typefield1 - calendar fieldfield2 - calendar field
public CalendarData(DateFormatType type,
java.lang.String stringValue,
java.text.ParsePosition status)
throws InvalidDataException
stringValue - string value to be parsedstatus - parse status (may be null)
InvalidDataException - if string value could not be parserTimestampData.setValue(String,ParsePosition),
DateFormatType.dateValue(String,ParsePosition)
public CalendarData(DateFormatType type,
java.util.Calendar calendar)
type - calendar typecalendar - calendar
public CalendarData(DateFormatType type,
CalendarData calendarData)
type - calendar typecalendarData - calendar data
public CalendarData(DateFormatType type,
CalendarFieldData cfd)
type - calendar typecfd - calendar field dataDateFormatType.createCalendar(CalendarField)
public CalendarData(DateFormatType type,
java.util.Date date)
type - calendar typedate - date
public CalendarData(DateFormatType type,
long milliseconds)
type - timestamp typemilliseconds - milliseconds value| Method Detail |
public void add(int field,
int amount)
field - the time fieldamount - the amount of date or time to be added to the fieldpublic int get(int field)
field - the time fieldpublic int getActualMaximum(int field)
field - the time fieldpublic int getActualMinimum(int field)
field - the time fieldpublic int getGreatestMinimum(int field)
field - the time fieldpublic int getLeastMaximum(int field)
field - the time fieldpublic int getMaximum(int field)
field - the time fieldpublic int getMinimum(int field)
field - the time field
public void roll(int field,
int amount)
field - the time fieldamount - the amount of date or time to be added to the fieldpublic void setTimeZone(java.util.TimeZone value)
value - the new time zone.public boolean isNull()
isNull in interface SerializableDataisNull in class TimestampDatapublic void setTime(long time)
public com.davisor.core.Dupable dup()
dup in interface com.davisor.core.Dupabledup in class TimestampDatapublic java.util.Calendar getCalendar()
setTime(long).
public DataValue ceil(java.util.Date precision)
throws InvalidDataException
ceil in class TimestampDataprecision - the precision within quantization occurs
InvalidDataException - if precision was of unacceptable typeTimestampData.ceil(DataValue),
floor(java.util.Date)public java.util.Calendar createCalendar()
createCalendar in class TimestampData
public DataValue floor(java.util.Date precision)
throws InvalidDataException
floor in class TimestampDataprecision - the precision within quantization occurs
InvalidDataException - if precision was of unacceptable typeceil(java.util.Date),
TimestampData.floor(DataValue)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||