Schedule

case
class Schedule(tasks: List[(Long, Long)])

A list of time intervals during which a TaskResource is scheduled to be busy.

Each interval is represented as a pair of timestamps.

Value Params
tasks

Busy time intervals as pairs of timestamps.

Example

Schedule(List( (1L,2L), (3L,4L) )) // The corresponding TaskResource is scheduled to be busy between 1L and 2L and between 3L and 4L, and idle between 0L and 1L, between 2L and 3L and after 4L.

Companion
object
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def +(start: Long, end: Long): Option[Schedule]

Adds another busy interval to the schedule.

Adds another busy interval to the schedule.

The new interval can only be added if it does not clash with any of the existing intervals.

Uses Schedule.add for the calculation.

Value Params
end

The end timestamp of the new interval.

start

The start timestamp of the new interval.

Returns

Some updated Schedule or scala.None upon failure.

See also
Example

Schedule(List((1L,2L), (6L,7L))) + (3,5) == Some(Schedule(List((1,2), (3,5), (6,7))))

Schedule(List((1L,3L), (6L,7L))) + (3,5) == Some(Schedule(List((1,5), (6,7))))

Schedule(List((1L,4L), (6L,7L))) + (3,5) == None

Merges the schedule with another one.

Merges the schedule with another one.

The merge involves adding all the busy intervals into a single schedule.

Uses Schedule.merge for the calculation.

Value Params
s

The other schedule to merge.

Returns

The new merged schedule.

See also
Example

Schedule(List((1L,2L), (5L,6L))) ++ Schedule(List((3L,4L))) == Schedule(List((1,2), (3,4), (5,6))

Schedule(List((1L,2L), (3L,5L))) ++ Schedule(List((2L,4L))) == Schedule(List((1,5)))

def +>(start: Long, end: Long): Schedule

Adds another busy interval to the schedule, if possible.

Adds another busy interval to the schedule, if possible.

The new interval can only be added if it does not clash with any of the existing intervals.

Uses Schedule.add for the calculation. Upon failure, returns the schedule unchanged.

Value Params
end

The end timestamp of the new interval.

start

The start timestamp of the new interval.

Returns

The updated schedule, or the same schedule if the update fails.

See also
Example

Schedule(List((1L,2L), (6L,7L))) +> (3,5) == Schedule(List((1,2), (3,5), (6,7)))

Schedule(List((1L,3L), (6L,7L))) +> (3,5) == Schedule(List((1,5), (6,7)))

Schedule(List((1L,4L), (6L,7L))) +> (3,5) == Schedule(List((1,4), (6,7)))

def +>(startTime: Long, t: TaskInstance): Schedule

Adds the estimated interval of a TaskInstance to the schedule, if possible.

Adds the estimated interval of a TaskInstance to the schedule, if possible.

The new interval can only be added if it does not clash with any of the existing intervals.

Uses Schedule.add for the calculation. Upon failure, returns the schedule unchanged.

Value Params
startTime

The timestamp the TaskInstance started.

t

The TaskInstance to be added.

Returns

The updated schedule, or the same schedule if the update fails.

See also
def ?(currentTime: Long, t: TaskInstance): Long

Finds the earliest possible start for a TaskInstance in the schedule.

Finds the earliest possible start for a TaskInstance in the schedule.

A TaskInstance fits into the schedule if the interval defined by the start time and the estimated duration of the TaskInstance has no overlap with any other interval in the schedule.

Uses Schedule.fit for the calculation.

Value Params
currentTime

The current (and thus earliest possible) time for the TaskInstance.

t

The TaskInstance to be checked.

Returns

The earliest possible start for the TaskInstance in this schedule.

See also
def isValid: Boolean

Checks if this is a valid schedule.

Checks if this is a valid schedule.

A valid schedule contains valid, ordered intervals, that do not overlap. Valid intervals have a start that is earlier than their end.

Uses Schedule.isValid for the calculation.

See also

Inherited methods

def productElementNames: Iterator[String]
Inherited from
Product
def productIterator: Iterator[Any]
Inherited from
Product