public class Calendar extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Calendar.ExcludedDay
This class represents a day excluded from the
working calendar.
|
static class |
Calendar.WorkingDay
This class represents the start and end time associated
with a working day.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT
This constant represents the name of the default calendar.
|
Constructor and Description |
---|
Calendar() |
Modifier and Type | Method and Description |
---|---|
protected Calendar |
createCalendar(long dateTime)
This method creates a calendar from the supplied date
time information and optionally configured timezone.
|
protected Calendar.WorkingDay |
findWorkingDay(Calendar cal)
This method returns the working day associated with the
supplied calendar.
|
List<Calendar.ExcludedDay> |
getExcludedDays()
This method returns the list of excluded days.
|
Calendar.WorkingDay |
getFriday()
This method returns the working day for Friday.
|
Calendar.WorkingDay |
getMonday()
This method returns the working day for Monday.
|
String |
getName()
This method returns the name of the calendar.
|
Calendar.WorkingDay |
getSaturday()
This method returns the working day for Saturday.
|
Calendar.WorkingDay |
getSunday()
This method returns the working day for Sunday.
|
Calendar.WorkingDay |
getThursday()
This method returns the working day for Thursday.
|
TimeZone |
getTimeZone()
This method returns the optional timezone of the
calendar.
|
Calendar.WorkingDay |
getTuesday()
This method returns the working day for Tuesday.
|
Calendar.WorkingDay |
getWednesday()
This method returns the working day for Wednesday.
|
long |
getWorkingDuration(long from,
long to)
This method calculates the number of milliseconds of working time
during the supplied timestamps.
|
void |
init()
This method initializes the calendar.
|
protected boolean |
isExcluded(Calendar cal)
This method checks whether the supplied calendar is
associated with an excluded day.
|
boolean |
isWorkingDateTime(long dateTime)
This method determines whether the supplied date/time
is part of the working day represented by this calendar.
|
Calendar |
setExcludedDays(List<Calendar.ExcludedDay> days)
This method sets the list of excluded days.
|
Calendar |
setFriday(Calendar.WorkingDay wd)
This method sets the working day for Friday.
|
Calendar |
setMonday(Calendar.WorkingDay wd)
This method sets the working day for Monday.
|
Calendar |
setName(String name)
This method sets the name of the calendar.
|
Calendar |
setSaturday(Calendar.WorkingDay wd)
This method sets the working day for Saturday.
|
Calendar |
setSunday(Calendar.WorkingDay wd)
This method sets the working day for Sunday.
|
Calendar |
setThursday(Calendar.WorkingDay wd)
This method sets the working day for Thursday.
|
Calendar |
setTimeZone(TimeZone timezone)
This method sets the timezone.
|
Calendar |
setTuesday(Calendar.WorkingDay wd)
This method sets the working day for Tuesday.
|
Calendar |
setWednesday(Calendar.WorkingDay wd)
This method sets the working day for Wednesday.
|
String |
toString() |
public static final String DEFAULT
public String getName()
public Calendar setName(String name)
name
- The namepublic TimeZone getTimeZone()
public Calendar setTimeZone(TimeZone timezone)
timezone
- The timezonepublic Calendar.WorkingDay getMonday()
public Calendar setMonday(Calendar.WorkingDay wd)
wd
- The working day, or null if a non-working daypublic Calendar.WorkingDay getTuesday()
public Calendar setTuesday(Calendar.WorkingDay wd)
wd
- The working day, or null if a non-working daypublic Calendar.WorkingDay getWednesday()
public Calendar setWednesday(Calendar.WorkingDay wd)
wd
- The working day, or null if a non-working daypublic Calendar.WorkingDay getThursday()
public Calendar setThursday(Calendar.WorkingDay wd)
wd
- The working day, or null if a non-working daypublic Calendar.WorkingDay getFriday()
public Calendar setFriday(Calendar.WorkingDay wd)
wd
- The working day, or null if a non-working daypublic Calendar.WorkingDay getSaturday()
public Calendar setSaturday(Calendar.WorkingDay wd)
wd
- The working day, or null if a non-working daypublic Calendar.WorkingDay getSunday()
public Calendar setSunday(Calendar.WorkingDay wd)
wd
- The working day, or null if a non-working daypublic List<Calendar.ExcludedDay> getExcludedDays()
public Calendar setExcludedDays(List<Calendar.ExcludedDay> days)
days
- The excluded dayspublic void init() throws Exception
Exception
- Failed to initializeprotected Calendar.WorkingDay findWorkingDay(Calendar cal)
cal
- The calendarprotected Calendar createCalendar(long dateTime)
dateTime
- The date/time infopublic boolean isWorkingDateTime(long dateTime)
dateTime
- The date/time to checkprotected boolean isExcluded(Calendar cal)
cal
- The calendarpublic long getWorkingDuration(long from, long to)
from
- The from timestampto
- The to timestampCopyright © 2013-2015 JBoss by Red Hat. All Rights Reserved.