Reference Source Test
public class | source

Task

Default task class describes general task robot behaviour during task execution

Static Member Summary

Static Public Members
public static get

Task is executing

public static get

Task is finished and it is not be consider in the future

public static get

Task is ready to be executed

public static get

Task is suspended and waiting a chance to become ready

Constructor Summary

Public Constructor
public

constructor(scheduler: *, parameters: Object)

Default constructor for task

Method Summary

Public Methods
public

finish()

Finish this task and run next one

public

Get current state

public

Get predicted time of current task

public

Get weight of current task

public

Condition which will be checked by SchedulerService to decide to run task or not.

public

onRun()

This method will be executed as soon as mep run this task

public

Change priority during runtime

public

run()

Run current task and change a state

public

setState(state: Number)

Set current state

public

setWeight(weight: *)

Change default weight of the task

public

Suspend this task and run next one

Static Public Members

public static get ACTIVE: number source

Task is executing

public static get FINISHED: number source

Task is finished and it is not be consider in the future

public static get READY: number source

Task is ready to be executed

public static get SUSPENDED: number source

Task is suspended and waiting a chance to become ready

Public Constructors

public constructor(scheduler: *, parameters: Object) source

Default constructor for task

Params:

NameTypeAttributeDescription
scheduler *

{Scheduler} Reference to strategy's scheduler

parameters Object

Additional params

parameters.weight Number

Importance of the task, initial order

parameters.time Number

Predicted time to be executed

parameters.location misc.Point

Predicted area of execution

Public Methods

public finish() source

Finish this task and run next one

public getState(): Number source

Get current state

Return:

Number

Can be Task.READY, Task.SUSPENDED, Task.ACTIVE and Task.FINISHED

public getTime(): Number source

Get predicted time of current task

Return:

Number

public getWeight(): Number source

Get weight of current task

Return:

Number

public isAvailable(): Boolean source

Condition which will be checked by SchedulerService to decide to run task or not. Eg. Release lunar modules only if there is lunar modules inside robot

Return:

Boolean

Returns true if task is ready to be executed

public onRun() source

This method will be executed as soon as mep run this task

public plusPriority(): number source

Change priority during runtime

Return:

number

public run() source

Run current task and change a state

public setState(state: Number) source

Set current state

Params:

NameTypeAttributeDescription
state Number

Can be Task.READY, Task.SUSPENDED, Task.ACTIVE and Task.FINISHED

public setWeight(weight: *) source

Change default weight of the task

Params:

NameTypeAttributeDescription
weight *

{Number}

public suspend() source

Suspend this task and run next one