package com.jscape.inet.ssh;

import java.util.EventObject;

import static com.jscape.util.Parameters.assertNotNull;

/**
 * @author Alex Usun
 */
public abstract class SshScriptEvent
        extends EventObject {

    protected SshTask task;

    protected SshScriptEvent(SshScript source, SshTask task) {
        super(source);

        assertNotNull(task);
        this.task = task;
    }

    /**
     * Gets the SshTask that has started.
     *
     * @return a <code>SshTask</code>
     */
    public SshTask getTask() {
        return this.task;
    }

    /**
     * Accepts listener for backwards dispatching.
     *
     * @param listener event listener
     */
    public abstract void accept(SshScriptListener listener);

}
