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

ca.appsimulations.jlqninterface.lqn.model.factory.TaskFactory Maven / Gradle / Ivy

Go to download

Java API to solve, analyze and manipulate Layered Qeueuing Network (LQN) models

There is a newer version: 1.1.0
Show newest version
package ca.appsimulations.jlqninterface.lqn.model.factory;

import ca.appsimulations.jlqninterface.lqn.entities.LqnDefaults;
import ca.appsimulations.jlqninterface.lqn.entities.Processor;
import ca.appsimulations.jlqninterface.lqn.entities.Task;
import ca.appsimulations.jlqninterface.lqn.entities.TaskSchedulingType;
import ca.appsimulations.jlqninterface.lqn.model.LqnModel;

public class TaskFactory {

    public static Task build(String name,
                             LqnModel lqnModel,
                             Processor processor,
                             boolean refTask,
                             int threads) {
        Task task = new Task(lqnModel,
                             name,
                             processor);
        if (refTask) {
            task.setScheduling(TaskSchedulingType.REF);
        }
        else {
            task.setScheduling(TaskSchedulingType.FIFO);
        }
        task.setMultiplicity(threads);
        task.setReplication(LqnDefaults.TASK_REPLICATION.getValue());
        return task;
    }

    public static Task build(String name,
                             LqnModel lqnModel,
                             Processor processor,
                             boolean refTask,
                             int threads,
                             int replicationCount) {
        Task task = new Task(lqnModel,
                             name,
                             processor);
        if (refTask) {
            task.setScheduling(TaskSchedulingType.REF);
        }
        else {
            task.setScheduling(TaskSchedulingType.FIFO);
        }
        task.setMultiplicity(threads);
        task.setReplication(replicationCount);
        return task;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy