ICalendar

public interface ICalendar

Represents a calendar abstraction which can be used for various calculations of dates and durations.

Methods

MethodDescription
getFinishDateByStartAndWork(Date start, Duration work)Calculates the date when the specified amount of work time will pass according to the calendar.
getFinishDateByStartAndWork(Date start, double work)Calculates the date when the specified amount of work time will pass according to the calendar.
getNextWorkingDayStart(Date date)Calculates next working day start for the specified date.
getPreviousWorkingDayEnd(Date date)Calculates the end of the previous working date from the specified date.
getStartDateFromFinishAndDuration(Date finish, Duration duration)Returns start date based on the specified finish date and duration.
getStartDateFromFinishAndDuration(Date finish, double duration)Returns start date based on specified finish date and duration.
getTaskFinishDateFromDuration(Task task, double duration)Calculates the task finish date and time from its start date, split parts and the work duration.
getWorkStart(Date date)Calculates next working time start beginning from the specified date and time.
getWorkingHours(Date dt)Returns the amount of working hours at the specified date.
getWorkingHours(Date start, Date finish)Return WorkUnit - Start, Finish and Duration of working hours for the specified date time interval.
getWorkingHoursTimeSpan(Date start, Date finish)Returns amount of working hours between the specified dates.
getWorkingTimes(Date dt)Returns WorkingTimeCollection of working times for the specified date.
isDayWorking(Date dt)Determines whether the specified day is a working day according to the calendar.
isEmpty()Returns whether the calendar doesn’t have working hours defined.

getFinishDateByStartAndWork(Date start, Duration work)

public abstract Date getFinishDateByStartAndWork(Date start, Duration work)

Calculates the date when the specified amount of work time will pass according to the calendar.

Parameters:

ParameterTypeDescription
startjava.util.DateStart date.
workDurationWork duration.

Returns: java.util.Date - Finish date.

getFinishDateByStartAndWork(Date start, double work)

public abstract Date getFinishDateByStartAndWork(Date start, double work)

Calculates the date when the specified amount of work time will pass according to the calendar.

Parameters:

ParameterTypeDescription
startjava.util.DateStart date.
workdoubleWork duration.

Returns: java.util.Date - Finish date.

getNextWorkingDayStart(Date date)

public abstract Date getNextWorkingDayStart(Date date)

Calculates next working day start for the specified date.

Parameters:

ParameterTypeDescription
datejava.util.DateThe date to get next working day start for.

Returns: java.util.Date - Next working day start System.DateTime.

getPreviousWorkingDayEnd(Date date)

public abstract Date getPreviousWorkingDayEnd(Date date)

Calculates the end of the previous working date from the specified date.

Parameters:

ParameterTypeDescription
datejava.util.Datethe date to calculate the previous working day end.

Returns: java.util.Date - The end of the previous working day end

getStartDateFromFinishAndDuration(Date finish, Duration duration)

public abstract Date getStartDateFromFinishAndDuration(Date finish, Duration duration)

Returns start date based on the specified finish date and duration.

Parameters:

ParameterTypeDescription
finishjava.util.DateThe specified finish date.
durationDurationThe specified duration.

Returns: java.util.Date - Calculated start date.

getStartDateFromFinishAndDuration(Date finish, double duration)

public abstract Date getStartDateFromFinishAndDuration(Date finish, double duration)

Returns start date based on specified finish date and duration.

Parameters:

ParameterTypeDescription
finishjava.util.DateThe specified finish date.
durationdoubleThe specified duration.

Returns: java.util.Date - Calculated start date.

getTaskFinishDateFromDuration(Task task, double duration)

public abstract Date getTaskFinishDateFromDuration(Task task, double duration)

Calculates the task finish date and time from its start date, split parts and the work duration.

Parameters:

ParameterTypeDescription
taskTaskThe task to calculate finish date for.
durationdoubleThe duration to calculate.

Returns DateTime.MinValue if task is summary, null or its start date is not set. |

Returns: java.util.Date - Task’s finish date for the given start date and duration.

getWorkStart(Date date)

public abstract Date getWorkStart(Date date)

Calculates next working time start beginning from the specified date and time.

Parameters:

ParameterTypeDescription
datejava.util.DateThe date and time.

Returns: java.util.Date - The nearest working time start.

getWorkingHours(Date dt)

public abstract double getWorkingHours(Date dt)

Returns the amount of working hours at the specified date.

Parameters:

ParameterTypeDescription
dtjava.util.DateThe date to get working hours for.

Returns: double - Working hours at the specified date.

getWorkingHours(Date start, Date finish)

public abstract WorkUnit getWorkingHours(Date start, Date finish)

Return WorkUnit - Start, Finish and Duration of working hours for the specified date time interval.

Parameters:

ParameterTypeDescription
startjava.util.DateStart date of the interval.
finishjava.util.DateFinish date of the interval.

Returns: WorkUnit - Instance of WorkUnit class containing Start, Finish and Duration of working hours.

getWorkingHoursTimeSpan(Date start, Date finish)

public abstract double getWorkingHoursTimeSpan(Date start, Date finish)

Returns amount of working hours between the specified dates.

Parameters:

ParameterTypeDescription
startjava.util.DateStart date of the interval.
finishjava.util.DateFinish date of the interval.

Returns: double - Amount of working hours according to the calendar instance.

getWorkingTimes(Date dt)

public abstract WorkingTimeCollection getWorkingTimes(Date dt)

Returns WorkingTimeCollection of working times for the specified date.

Parameters:

ParameterTypeDescription
dtjava.util.DateThe date to get working times for.

Returns: WorkingTimeCollection - Collection of WorkingTime instances.

isDayWorking(Date dt)

public abstract boolean isDayWorking(Date dt)

Determines whether the specified day is a working day according to the calendar.

Parameters:

ParameterTypeDescription
dtjava.util.DateThe date to check whether the day is working.

Returns: boolean - True if the day is a working day.

isEmpty()

public abstract boolean isEmpty()

Returns whether the calendar doesn’t have working hours defined.

Returns: boolean - True if the calendar doesn’t have working hours defined.