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

de.scravy.machina.StatelessStateMachineWithContext Maven / Gradle / Ivy

Go to download

A finite state machine library that features true stateless state machines.

There is a newer version: 1.3.1
Show newest version
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 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