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

jpower.core.internal.CancelStateTracker Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package jpower.core.internal;

import jpower.core.Task;

import java.util.Collection;
import java.util.HashSet;

public class CancelStateTracker
{

    private static final Collection states = new HashSet<>();

    public static void setCancelled(Task task, boolean cancel)
    {
        if (cancel)
        {
            states.add(task);
        }
        else
        {
            states.remove(task);
        }
    }

    public static boolean isCancelled(Task task)
    {
        return states.contains(task);
    }

    protected static void clear()
    {
        states.clear();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy