Type members
Value members
Concrete methods
Adds an interval to a list of intervals.
Adds an interval to a list of intervals.
Fails and returns scala.None if the new interval clashes with any of the existing intervals, i.e. there is overlapping time.
- Value Params
- end
The end timestamp of the interval.
- result
The accumulated result so far (for tail recursion).
- start
The start timestamp of the interval.
- tasks
The list of intervals to add to.
- Returns
Some updated list of intervals, or scala.None if there was an overlap.
- See also
- Example
add(3, 5, List((1,2), (6,7))) == Some(List((1,2), (3,5), (6,7)))
add(3, 5, List((1,3), (6,7))) == Some(List((1,5), (6,7)))
add(3, 5, List((1,4), (6,7))) == None
Creates a Schedule from a TaskResource based on its currently running TaskInstance (if any).
Creates a Schedule from a TaskResource based on its currently running TaskInstance (if any).
- Value Params
- r
The TaskResource to schedule for.
- Returns
The initialised schedule.
Finds the earliest time when a fixed task duration can fit into a list of busy intervals.
Finds the earliest time when a fixed task duration can fit into a list of busy intervals.
A fixed duration fits at a particular starting time t
if the interval (t, t+duration)
has
no overlap with the existing intervals in the list. It can '''always''' fit after the end of
the last interval in the list, but the function returns the earliest possible start.
- Value Params
- duration
The task duration to consider.
- start
The initial starting time to check for.
- tasks
The list of intervals to check against.
- Returns
The earliest possible start for the given task duration.
- See also
- Example
fit(0, 2, List((0,2), (3,4), (6,7))) == 4
fit(0, 2, List((0,2), (3,4), (5,7))) == 7
fit(0, 2, List((2,4), (5,7))) == 0
Checks if a list of intervals is valid
Checks if a list of intervals is valid
For it to be valid it must:
- Contain valid intervals, i.e. intervals with a start that is strictly before the end.
- The intervals are strictly ordered, i.e. the start of an interval is always strictly after the end of the previous one.
- Value Params
- end
The current end timestamp to check against (for tail recursion).
- gaps
The list of intervals.
Merges two lists of intervals into one.
Merges two lists of intervals into one.
Intervals that overlap partially or fully, or are adjacent (the end time of one is the start time of the other) are merged into one interval.
- Value Params
- g1
The first list of intervals to merge.
- g2
The second list of intervals to merge.
- result
The accumulated result so far (for tail recursion).
- Returns
The merged list of intervals.
- See also
- Example
merge(List((1,2), (5,6)), List((3,4))) == List((1,2), (3,4), (5,6))
merge(List((1,2), (3,5)), List((2,4))) == List((1,5))
Merges a sequence of Schedules using Schedule.++.
Merges a sequence of Schedules using Schedule.++.
- Value Params
- schedules
The sequence of schedules to merge.
- Returns
The merged schedule.
Deprecated methods
- Deprecated
- Deprecated