Lookahead

trait Lookahead

A Lookahead contains information about the order in which tasks run.

The structure is immutable. It is built by the simulation and passed to the scheduler where it is used for scheduling by revealing information about future tasks so that look-ahead can be achieved.

class Object
trait Matchable
class Any

Value members

Abstract methods

def ++(function: Map[UUID, Long] => Option[Long], generators: List[Task]): Lookahead

Adds an entry to the structure

Adds an entry to the structure

An entry is comprised of a function that describes the prerequisites and resultant starting time of a set of tasks, and a list of Tasks that should start if this function returns Some(value).

The function has type Map[UUID,Long]=>Option[Long]. It should take a map that contains the IDs of completed/scheduled tasks and their respective finishing times, and it should return None if the prerequisites of this entry are not met, and Some(value) if the prerequisites are met, where value should be the starting time of the tasks contained in this entry. This allows us to express a complex relationship whereby the starting time of the tasks in this lookahead entry can be an intricate function of the finishing times of the prerequisites.

Value Params
function

The function that describes the prerequisites of this entry. Should return None if the prerequisites are not met, or Some(value) if the prerequistes are met, where the value is the starting time of the tasks in this entry.

generators

A list of Tasks that describes the tasks that should start if the prerequistes are met.

Returns

A Lookahead with the specified entry added to it.

def -(id: UUID): Lookahead

Removes a task with the corresponding ID from the structure

Removes a task with the corresponding ID from the structure

Once removed, the task with this ID will no longer be returned.

Value Params
id

The id of the task

Returns

A Lookahead with the specified task removed.

def getTaskData(scheduled: Iterable[(UUID, Long)]): Seq[(Task, Long)]

Retrieves all tasks that can start given the list of scheduled/completed tasks

Retrieves all tasks that can start given the list of scheduled/completed tasks

Value Params
scheduled

The list of tasks that have been scheduled/completed, described with an (ID,time) tuple

Returns

The list of tasks that can start, described by (Task,starting_time) tuples

Concrete methods

def +(function: Map[UUID, Long] => Option[Long], generator: Task): Lookahead

Provides a nicer interface for adding elements to the lookeahead structure.

Provides a nicer interface for adding elements to the lookeahead structure.

Allows adding a single generator instead of a list of generators.

Value Params
function

The function describing the conditions of starting the correspoinding task.

generator

The task that will start when the conditions are met.

See also
def +>(sourceID: UUID, generator: Task): Lookahead

Provides a nicer interface for adding elements to the lookeahead structure.

Provides a nicer interface for adding elements to the lookeahead structure.

Allows adding a simple one-to-one relationship, where the generator task starts right after the sourceID task finishes.

Value Params
generator

The generator fo the task that will start when the prior task finishes.

sourceID

The id of the task that will finish.

See also
def +>>(source: Set[UUID], generator: Task): Lookahead
def and(that: Lookahead): Lookahead

Combines two Lookaheads

Combines two Lookaheads

Value Params
that

The other Lookahead to merge with this one.

Returns

The merged Lookahead