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

jalse.actions.Action Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package jalse.actions;

/**
 * Action is the JALSE equivalent of {@link Runnable}. They must be scheduled by
 * {@link ActionEngine} but can also be delegate scheduled referencing a specific actor with
 * {@link ActionScheduler}. Actions are the only non-optional value when creating
 * {@link MutableActionContext} - which are required to build how the Action will be scheduled.
 *
 * @author Elliot Ford
 *
 * @param 
 *            Type of actor to be supplied (can be {@code ?} for no actor).
 *
 * @see ActionEngine#newContext(Action)
 * @see ActionEngine#schedule(Action, Object)
 * @see ActionScheduler#scheduleForActor(Action, long, long, java.util.concurrent.TimeUnit)
 */
@FunctionalInterface
public interface Action {

    /**
     * Performs the actions using the supplied action context.
     *
     * @param context
     *            Current action context.
     * @throws InterruptedException
     *             Can throw interrupted when awaiting other actions.
     *
     * @see Runnable#run()
     */
    void perform(ActionContext context) throws InterruptedException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy