All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bear.task.TaskContext Maven / Gradle / Ivy

The newest version!
package bear.task;

import bear.context.HavingContext;
import bear.core.Bear;
import bear.core.BearScriptPhase;
import bear.core.GlobalTaskRunner;
import bear.core.SessionContext;
import bear.main.phaser.ComputingGrid;
import bear.main.phaser.Phase;
import bear.main.phaser.PhaseParty;

import javax.annotation.Nullable;

/**
 * @author Andrey Chaschev [email protected]
 */
public class TaskContext> extends HavingContext>, SessionContext> {
    Task me;

    @Nullable
    Task> parent;

    TaskDef definition;
    SessionRunner runner;
    ComputingGrid>> grid;
    Phase> phase;
    Bear bear;
    PhaseParty> phaseParty;

    TaskExecutionContext executionContext;
    GlobalTaskRunner globalRunner;

    I input;

    public TaskContext(Task me, Task parent, SessionContext $) {
        super($);
        this.me = me;
        this.parent = parent;
    }

    public TaskContext(Task me, Task parent, SessionContext $, TaskDef definition) {
        super($);
        this.me = me;
        this.parent = parent;
        this.definition = definition;
    }

    public TaskContext(
        Task parent, SessionContext $, SessionRunner runner,
        Task me, TaskDef definition,
        ComputingGrid>> grid,
        Phase> phase, Bear bear, PhaseParty> phaseParty, TaskExecutionContext executionContext) {

        super($);
        this.parent = parent;
        this.runner = runner;
        this.me = me;
        this.definition = definition;
        this.grid = grid;
        this.phase = phase;
        this.bear = bear;
        this.phaseParty = phaseParty;
        this.executionContext = executionContext;
    }

    public TaskContext dup(Task me) {
        return new TaskContext(
            parent, $, runner, me, definition, grid, phase, bear,
            phaseParty, executionContext
        );
    }

    public TaskContext dup(Task me, TaskDef def, Task parent) {
        TaskContext r = dup(me);

        r.parent = parent;
        r.definition = def;

        return r;
    }

    public GlobalTaskRunner getGlobalRunner() {
        return globalRunner;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy