IStatemachine.java 1.2 KB

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