/** 
 * Copyright (c) 2009-2011, The HATS Consortium. All rights reserved. 
 * This file is licensed under the terms of the Modified BSD License.
 */
package org.abs_models.backend.java.scheduling;

import org.abs_models.backend.java.lib.runtime.COG;
import org.abs_models.backend.java.observing.TaskView;

/**
 * Abstract class which represents a global scheduling action
 * 
 * @author Jan Schäfer
 *
 */
public abstract class ScheduleAction {
    private final COG cog;
    private boolean executed;

    public ScheduleAction(COG cog) {
        this.cog = cog;
    }

    public COG getCOG() {
        return cog;
    }

    public TaskView getTask() {
        return null;
    }

    public synchronized void execute() {
        executed = true;
        notify();
    }

    public synchronized void await() throws InterruptedException {
            while (!executed) {
                wait();
            }
    }

    public abstract String shortString();

}
