IStatemachine.java 947 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package traffic.light;
  2. /**
  3. * Basic interface for state machines.
  4. */
  5. public interface IStatemachine {
  6. /**
  7. * Initializes the state machine. Used to initialize internal variables etc.
  8. */
  9. public void init();
  10. /**
  11. * Enters the state machine. Sets the state machine into a defined state.
  12. */
  13. public void enter();
  14. /**
  15. * Exits the state machine. Leaves the state machine with a defined state.
  16. */
  17. public void exit();
  18. /**
  19. * Checks whether the state machine is active.
  20. * A state machine is active if it has been entered. It is inactive if it has not been entered at all or if it has been exited.
  21. */
  22. public boolean isActive();
  23. /**
  24. * Checks whether all active states are final.
  25. * If there are no active states then the state machine is considered being incative. In this case this method returns <code>false</code>.
  26. */
  27. public boolean isFinal();
  28. /**
  29. * Start a run-to-completion cycle.
  30. */
  31. public void runCycle();
  32. }