Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
808 B
8
Indexable
import java.util.ArrayList;
import java.util.Arrays;

public class Monitor {
    private int checks;
    private boolean [] booleans;

    public Monitor(int size, int checks)
    {
        this.checks = checks;
        booleans = new boolean[size];
    }

    public void setBool(int i)
    {
        System.out.println("CHANGE");
        booleans[i] = !booleans[i];
    }

    public int getChecks()
    {

        return checks;
    }

    public boolean isFinished()
    {
        for (int i = 0; i<booleans.length; i++)
        {
            if (!booleans[i])
                return false;
        }
        return true;
    }

    public void setBooleansFalse()
    {
        for (int i=0; i<checks; i++) {
            booleans[i] = false;
        }
    }

}