public class WorkCalendarHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
WorkCalendarHelper.CalendarTimeSlot
a utility class to store a timeslot in time.
|
Constructor and Description |
---|
WorkCalendarHelper(Workcalendar calendar)
Creates a new helper for the specified work calendar
|
Modifier and Type | Method and Description |
---|---|
void |
createbufferarounddate(java.util.Date date)
creates a buffer of periods that are 1 year before and 2 years after the date
given.
|
long |
getActiveDurationInMinutes(java.util.Date starttime,
java.util.Date endtime)
this method provides the active duration in minutes between startime and
endtime.
|
WorkCalendarHelper.CalendarTimeSlot[] |
getAllSlotsForTimeSlot(java.util.Date starttime,
java.util.Date endtime)
creates slots as followed:
one slot per intersection of the timeslot and business open period
if a slot ends outside business hours, it should be created as between
the end of the last business slot and the invalid date
if a slot starts outside business houlrs, it should be created as between
the invalid date and the start of the business day
|
java.util.Date |
getEndDate(java.util.Date starttime,
long lengthinminute)
gets the end date for the period
|
java.util.Date |
getNextEndDate(java.util.Date newstartdate,
long l) |
java.util.Date |
getNextStartDate(java.util.Date endtime)
get next start date valid for the timeslot.
|
java.lang.String |
getWorkCalendarString()
This method returns a compact String encoding a work calendar.
|
public WorkCalendarHelper(Workcalendar calendar)
calendar
- the calendar to usepublic java.lang.String getWorkCalendarString()
public void createbufferarounddate(java.util.Date date)
date
- the start datepublic java.util.Date getNextStartDate(java.util.Date endtime)
endtime
- endtime of the previous slotpublic long getActiveDurationInMinutes(java.util.Date starttime, java.util.Date endtime)
starttime
- endtime
- public java.util.Date getEndDate(java.util.Date starttime, long lengthinminute)
starttime
- the start of the slot (typically got through
getNextStartDate)lengthinminute
- length of the slot in minutespublic WorkCalendarHelper.CalendarTimeSlot[] getAllSlotsForTimeSlot(java.util.Date starttime, java.util.Date endtime)
starttime
- start of the timeslotendtime
- end of the timeslotpublic java.util.Date getNextEndDate(java.util.Date newstartdate, long l)
newstartdate
- start date of the new periodl
- length in minute