SCalendar-1.1.0: This is a library for handling calendars and resource availability based on the "top-nodes algorithm" and set operations.

Time.SCalendar.Types

Synopsis

# Documentation

This data type is either a TimeInterval of the form (start-date, end-date) or a TimeUnit which, in this case, is a nominal day. The time unit of this calendar library is a nominal day, that is, 86400 seconds. TimeIntervals as well as TimeUnits are stored as UTCTime so that it is easy to transform results to local time or store results in databases as timestamps.

Constructors

 TimeInterval UTCTime UTCTime TimeIntervals represent the number of days that a node in a calendar covers from a start-date up to an end-date. TimeUnit UTCTime TimeUnits are only encountered in the leaves of a calendar and represent a specific day of the calendar.

Instances

 Source # Methods Source # MethodsshowList :: [TimePeriod] -> ShowS #

A Reservation is the product of a set of identifiers and a TimePeriod over which the resources identified by the set will be reserved.

Constructors

 Reservation FieldsreservUnits :: Set TextSet of identifiers which point to reservable resources.reservPeriod :: TimePeriodTimePeriod over which the resources will be reserved.

Instances

 Source # Methods Source # MethodsshowList :: [Reservation] -> ShowS #

A Cancellation is the product of a set of identifiers which point to resources previously reserved in a Calendar and a TimePeriod over which those resources were reserved.

Constructors

 Cancellation FieldscancUnits :: Set TextSet of identifiers which point to resources to be cancelled.cancPeriod :: TimePeriodTimePeriod over which the resources will be cancelled.

Instances

 Source # Methods Source # MethodsshowList :: [Cancellation] -> ShowS #

data SCalendar Source #

An SCalendar is the product of a set of identifiers, which point to a set of available resources, and a Calendar.

Constructors

 SCalendar FieldscalUnits :: Set TextSet of resources which can be reserved for the TimePeriod covered by the root node of the Calendar.calendar :: CalendarCalendar which covers the complete period of time over which a set of resources can be reserved.

Instances

 Source # Methods Source # MethodsshowList :: [SCalendar] -> ShowS #

data Calendar Source #

A Calendar is a recursive tree-structure whose nodes are TimePeriods representing the interval of time covered by them. TimeUnits are only encountered in the leaves since they represent specific days, or time units, of the Calendar. The unit of time of this Calendar library is a nominal day (or 86400 seconds). Each node of a Calendar also carries additional data according to the "top-nodes" algorithm: a Q set and a QN set. For more information about the meaning of these sets visit: https://en.wikipedia.org/wiki/Top-nodes_algorithm

Constructors

 Unit TimePeriod (Set Text) (Set Text) Node TimePeriod (Set Text) (Set Text) Calendar Calendar

Instances

 Source # Methods Source # MethodsshowList :: [Calendar] -> ShowS #

data Report Source #

A Report represents a summary of important facts related to an SCalendar.

Constructors

 Report FieldsreportPeriod :: TimePeriodThe TimePeriod which the report covers.totalUnits :: Set TextThe set of total identifiers reservable in the SCalendar this Report belongs to.reservedUnits :: Set TextThe set of total identifiers which have been reserved in a TimePeriod in the SCalendar related to this Report.remainingUnits :: Set TextThe set of total identifiers which are still available in a Time

Instances

 Source # Methods(==) :: Report -> Report -> Bool #(/=) :: Report -> Report -> Bool # Source # MethodsshowsPrec :: Int -> Report -> ShowS #showList :: [Report] -> ShowS #

Check if a time-period t1 is included in a time-period t2. Note that neither a TimeUnit can be included in another TimeUnit nor a TimeInterval can be included in a TimeUnit. If two TimeIntervals are equal they are said to be included in one another.

Getter function to get the UTCTime start-date from a TimePeriod. For a TimeUnit the start-sate and the end-date are equal.

Getter function to fet the UTCTime end-date from a TimePeriod. Again, for a TimeUnit the start-sate and the end-date are equal.

This function transforms a TimeInterval into a TimeUnit in case that the start-date and end-date of that TimeInterval are equal.

Arguments

 :: Integer Year. -> Int Month. -> Int Day. -> Int Number of days covered by TimePeriod. -> Maybe TimePeriod

Given a year, a month and a day this function creates a time period which covers the specified number of days.

Arguments

 :: TimePeriod TimePeriod which the rerservation will cover. -> Set Text Set of identifiers which point to the resources to be reserved from an SCalendar. -> Maybe Reservation

Given a TimePeriod and a set of identifiers this function creates a reservation.

Arguments

 :: TimePeriod TimePeriod which the cancellation will cover. -> Set Text Set of identifiers which point to the resources to be cancelled from an SCalendar. -> Maybe Cancellation

Given a TimePeriod and a set of identifiers this function creates a cancellation.

Arguments

 :: Integer Year. -> Int Month. -> Int Day. -> Int Number of days covered by the Calendar. -> Maybe Calendar

Given a year, a month, and a day this function creates a Calendar which covers the specified number of days. The TimePeriod in the root node of a Calendar does not exactly span the number of days specified in the function, but a number of days which is a power of 2 and which is greater than or equal to the number of days specified.

Arguments

 :: Integer Year. -> Int Month. -> Int Day. -> Int Number of days covered by the Calendar. -> Set Text Set of resources which can be reserved for the TimePeriod covered by the root node of the Calendar. -> Maybe SCalendar

This constructor additionally attaches a set of identifiers, which point to the available resources of the calendar. Thus, this function creates an SCalendar which is basically a Calendar with a set of resources which can be reserved over the period of time determined by the root node of the Calendar.