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

com.codingapi.tx.framework.task.TaskGroup Maven / Gradle / Ivy

There is a newer version: 4.1.0
Show newest version
package com.codingapi.tx.framework.task;


import java.util.ArrayList;
import java.util.List;

/**
 * create by lorne on 2017/8/22
 */
public class TaskGroup {

    private String key;

    private List tasks;

    private TxTask current;

    private int state;


    public TxTask getCurrent() {
        return current;
    }

    public void setCurrent(TxTask current) {
        this.current = current;
    }

    public String getKey() {
        return key;
    }


    public TaskGroup() {
        tasks = new ArrayList<>();
    }

    public void setKey(String key) {
        this.key = key;
    }

    public List getTasks() {
        return tasks;
    }

    public void addTask(TxTask task) {
        tasks.add(task);
    }


    public boolean isAwait(){
        for(TxTask task: getTasks()){
            if(!task.isAwait()){
                return false;
            }
        }
        return true;
    }

    public boolean isRemove(){
        for(TxTask task: getTasks()){
            if(!task.isRemove()){
                return false;
            }
        }
        return true;
    }



    public void signalTask(){
        for(TxTask task: getTasks()){
            task.setState(state);
            task.signalTask();
        }
    }


    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy