|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.aduna.gee.publication.util.DateSpec
public class DateSpec
A DateSpec specifies which dates are valid and which are not. It can used e.g. in a DateTemplate for specifying the dates for which the template should be used.
The DateSpec has four fields: legal years, legal months, legal dates and
legal weekdays, separated by a colon. Each field can be specified to be
valid for any value ('*') or as a range (e.g.: "1, 3, 5-9, 12-15, 30").
If a range is specified, its values should be legal values for the
specific field. These legal values are:
year: -100,000 - 100,000 month: 1 - 12 date: 1 - 31 weekday: 0 - 7 (0 and 7 = Sunday, 1 = monday, etc.)
A date specification should fit the following grammar:
dateSpec := Years:Months:Dates:Weekdays
Years := Range
Months := Range
Dates := Range
Weekdays := Range
Range := SubRange [,SubRange]*
| '*'
SubRange := N
| N-N
Where N is a legal value the part it is in (Years, Months, etc.).
| Field Summary | |
|---|---|
protected Vector |
_dates
The valid date ranges. |
protected Vector |
_months
The valid month ranges. |
protected Vector |
_weekdays
The valid weekday ranges. |
protected Vector |
_years
The valid year ranges. |
| Constructor Summary | |
|---|---|
DateSpec(String spec)
Creates a new date specification. |
|
| Method Summary | |
|---|---|
protected void |
_setRange(String range,
Vector subranges)
Set a range to a new value. |
protected boolean |
_valueInRange(int value,
Vector ranges)
Check if a value is in a certain range. |
boolean |
includes(WDate date)
Check if the date specification includes a certain date. |
void |
setSpec(String spec)
Set the date specification. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Vector _years
protected Vector _months
protected Vector _dates
protected Vector _weekdays
| Constructor Detail |
|---|
public DateSpec(String spec)
spec - the date specification to use.
IllegalArgumentException - if "spec" is not a legal date
specification.| Method Detail |
|---|
public void setSpec(String spec)
spec - the date specification to set.
IllegalArgumentException - if "spec" is not a legal date
specification.
protected void _setRange(String range,
Vector subranges)
range - the new value (e.g.: "3, 4-5, 9").subranges - the vector in which to store the new subranges.public boolean includes(WDate date)
date - the date to check.
protected boolean _valueInRange(int value,
Vector ranges)
value - the value to check.range - a vector containing ranges.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||