rinde.sim.util.fsm.AbstractState Maven / Gradle / Ivy
/**
*
*/
package rinde.sim.util.fsm;
import javax.annotation.Nullable;
/**
* Default empty implementation of state. Subclasses only need to implement the
* {@link AbstractState#handle(Object, Object)} method.
* @param The event type, see {@link StateMachine} for more information.
* @param The context type, see {@link StateMachine} for more information.
* @author Rinde van Lon
*/
public abstract class AbstractState implements State {
@Override
public String name() {
return getClass().getName();
}
@Nullable
@Override
public abstract E handle(@Nullable E event, C context);
@Override
public void onEntry(E event, C context) {}
@Override
public void onExit(E event, C context) {}
}