Interface ICalendar

  • All Known Implementing Classes:
    Calendar

    public interface ICalendar

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

    • Method Detail

      • getFinishDateByStartAndWork

        Date getFinishDateByStartAndWork​(Date start,
                                         Duration work)

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

        Parameters:
        start - Start date.
        work - Work duration.
        Returns:
        Finish date.
      • getFinishDateByStartAndWork

        Date getFinishDateByStartAndWork​(Date start,
                                         double work)

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

        Parameters:
        start - Start date.
        work - Work duration.
        Returns:
        Finish date.
      • getNextWorkingDayStart

        Date getNextWorkingDayStart​(Date date)

        Calculates next working day start for the specified date.

        Parameters:
        date - The date to get next working day start for.
        Returns:
        Next working day start System.DateTime.
      • getPreviousWorkingDayEnd

        Date getPreviousWorkingDayEnd​(Date date)

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

        Parameters:
        date - the date to calculate the previous working day end.
        Returns:
        The end of the previous working day end
      • getStartDateFromFinishAndDuration

        Date getStartDateFromFinishAndDuration​(Date finish,
                                               Duration duration)

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

        Parameters:
        finish - The specified finish date.
        duration - The specified duration.
        Returns:
        Calculated start date.
      • getStartDateFromFinishAndDuration

        Date getStartDateFromFinishAndDuration​(Date finish,
                                               double duration)

        Returns start date based on specified finish date and duration.

        Parameters:
        finish - The specified finish date.
        duration - The specified duration.
        Returns:
        Calculated start date.
      • getTaskFinishDateFromDuration

        Date getTaskFinishDateFromDuration​(Task task,
                                           double duration)

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

        Parameters:
        task - The task to calculate finish date for.
        duration - The duration to calculate.

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

        Returns:
        Task's finish date for the given start date and duration.
      • getWorkStart

        Date getWorkStart​(Date date)

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

        Parameters:
        date - The date and time.
        Returns:
        The nearest working time start.
      • getWorkingHours

        WorkUnit getWorkingHours​(Date start,
                                 Date finish)

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

        Parameters:
        start - Start date of the interval.
        finish - Finish date of the interval.
        Returns:
        Instance of WorkUnit class containing Start, Finish and Duration of working hours.
      • getWorkingHours

        double getWorkingHours​(Date dt)

        Returns the amount of working hours at the specified date.

        Parameters:
        dt - The date to get working hours for.
        Returns:
        Working hours at the specified date.
      • getWorkingHoursTimeSpan

        double getWorkingHoursTimeSpan​(Date start,
                                       Date finish)

        Returns amount of working hours between the specified dates.

        Parameters:
        start - Start date of the interval.
        finish - Finish date of the interval.
        Returns:
        Amount of working hours according to the calendar instance.
      • isDayWorking

        boolean isDayWorking​(Date dt)

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

        Parameters:
        dt - The date to check whether the day is working.
        Returns:
        True if the day is a working day.
      • isEmpty

        boolean isEmpty()

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

        Returns:
        True if the calendar doesn't have working hours defined.