
de.scravy.machina.StatelessStateMachineWithContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of machina Show documentation
Show all versions of machina Show documentation
A finite state machine library that features true stateless
state machines.
package de.scravy.machina;
import java.util.Collection;
/**
* INTERNAL
*/
class StatelessStateMachineWithContext
extends AbstractStateMachine
implements StateMachineWithContext {
StatelessStateMachineWithContext(final S initial,
final Iterable> transitionList, final Class states,
final Class events, final Class eventTypes,
final Class contextClass,
final EventTypeClassifier eventTypeClassifier,
final Collection> listeners) {
super(initial, transitionList, states, events, eventTypes, contextClass,
eventTypeClassifier, listeners);
}
@Override
public RunResult run(final Iterable extends E> events, final C context) {
if (context == null) {
throw new IllegalArgumentException("context");
}
return super.run(events, context);
}
@Override
public RunResult run(final S currentState, final E event,
final C context) {
if (context == null) {
throw new IllegalArgumentException("context");
}
return super.run(currentState, event, context);
}
@Override
public StatefulStateMachineWithContext withState(final C context) {
return new StateMachineWithStateAndContext(this, context);
}
@Override
public StatefulStateMachineWithContext withState(
final C context, final S currentState) {
return new StateMachineWithStateAndContext(
this, context, currentState);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy