IStatemachine.java 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /** Copyright (c) 2012-2015 committers of YAKINDU and others.
  2. All rights reserved. This program and the accompanying materials
  3. are made available under the terms of the Eclipse Public License v1.0
  4. which accompanies this distribution, and is available at
  5. http://www.eclipse.org/legal/epl-v10.html
  6. Contributors:
  7. committers of YAKINDU - initial API and implementation
  8. � */
  9. package traffic.light;
  10. /**
  11. * Basic interface for state machines.
  12. */
  13. public interface IStatemachine {
  14. /**
  15. * Initializes the state machine. Used to initialize internal variables etc.
  16. */
  17. public void init();
  18. /**
  19. * Enters the state machine. Sets the state machine into a defined state.
  20. */
  21. public void enter();
  22. /**
  23. * Exits the state machine. Leaves the state machine with a defined state.
  24. */
  25. public void exit();
  26. /**
  27. * Checks whether the state machine is active.
  28. * 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.
  29. */
  30. public boolean isActive();
  31. /**
  32. * Checks whether all active states are final.
  33. * If there are no active states then the state machine is considered being incative. In this case this method returns <code>false</code>.
  34. */
  35. public boolean isFinal();
  36. /**
  37. * Start a run-to-completion cycle.
  38. */
  39. public void runCycle();
  40. }