Merge branch 'release/2.1.2'
This commit is contained in:
commit
4ba45f2c27
2
pom.xml
2
pom.xml
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<groupId>me.bvn13</groupId>
|
<groupId>me.bvn13</groupId>
|
||||||
<artifactId>fsm</artifactId>
|
<artifactId>fsm</artifactId>
|
||||||
<version>2.1.1</version>
|
<version>2.1.2</version>
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import java.util.function.Supplier;
|
|||||||
* <p>
|
* <p>
|
||||||
* <b>Final State Machine</b>
|
* <b>Final State Machine</b>
|
||||||
* </p>
|
* </p>
|
||||||
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Each state machine must be prepared with:
|
* Each state machine must be prepared with:
|
||||||
* <ol>
|
* <ol>
|
||||||
@ -25,7 +26,6 @@ import java.util.function.Supplier;
|
|||||||
* <li>Intermediate states - optionally</li>
|
* <li>Intermediate states - optionally</li>
|
||||||
* <li>All transitions needed</li>
|
* <li>All transitions needed</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Each {@link State} may be specified with handlers:
|
* Each {@link State} may be specified with handlers:
|
||||||
@ -34,7 +34,6 @@ import java.util.function.Supplier;
|
|||||||
* <li>After handler - is called right before FSM changes FROM this state to another</li>
|
* <li>After handler - is called right before FSM changes FROM this state to another</li>
|
||||||
* <li>Processor - the method to process events</li>
|
* <li>Processor - the method to process events</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Transition is the Rule providing FSM the possibility to change between states.
|
* Transition is the Rule providing FSM the possibility to change between states.
|
||||||
@ -46,12 +45,10 @@ import java.util.function.Supplier;
|
|||||||
* <li>Condition - optionally. If specified, the FSM will check the condition in order to check the possibility
|
* <li>Condition - optionally. If specified, the FSM will check the condition in order to check the possibility
|
||||||
* to change from FROM State into TO State</li>
|
* to change from FROM State into TO State</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Simple way to use it - to construct an inherited class specified with the type of events to be processed
|
* Simple way to use it - to construct an inherited class specified with the type of events to be processed
|
||||||
* during transitions.
|
* during transitions.
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* {@code
|
* {@code
|
||||||
@ -79,35 +76,29 @@ import java.util.function.Supplier;
|
|||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Otherwise you are able to use Old syntax:
|
* Otherwise you are able to use Old syntax:
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* {@code
|
|
||||||
* NamedFsm namedFsm = new NamedFsm().setName("TEST FSM");
|
* NamedFsm namedFsm = new NamedFsm().setName("TEST FSM");
|
||||||
* namedFsm.initState(new State<String>("init") {
|
* namedFsm.initState(new State<String>("init") {
|
||||||
* @Override
|
|
||||||
* public void process(String event) {
|
* public void process(String event) {
|
||||||
* initStatedProcessed.set(true);
|
* initStatedProcessed.set(true);
|
||||||
* }
|
* }
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* namedFsm.addTransition("init", new State<String>("first", true) {
|
* namedFsm.addTransition("init", new State<String>("first", true) {
|
||||||
* @Override
|
|
||||||
* public void process(String event) {
|
* public void process(String event) {
|
||||||
* firstStatedProcessed.set(true);
|
* firstStatedProcessed.set(true);
|
||||||
* }
|
* }
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* namedFsm.addTransition("init", new State<String>("another", true) {
|
* namedFsm.addTransition("init", new State<String>("another", true) {
|
||||||
* @Override
|
|
||||||
* public void process(String event) {
|
* public void process(String event) {
|
||||||
* anotherStatedProcessed.set(true);
|
* anotherStatedProcessed.set(true);
|
||||||
* }
|
* }
|
||||||
* }, (fsm, event) -> false);
|
* }, (fsm, event) -> false);
|
||||||
*
|
*
|
||||||
* namedFsm.init();
|
* namedFsm.init();
|
||||||
* }
|
* </pre>
|
||||||
* </pre> *
|
|
||||||
* {@link SimpleFsm}
|
* {@link SimpleFsm}
|
||||||
*/
|
*/
|
||||||
public class Fsm<T extends Fsm, E> {
|
public class Fsm<T extends Fsm, E> {
|
||||||
|
@ -2,7 +2,7 @@ package me.bvn13.fsm;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* State handler
|
* State handler
|
||||||
* @param <T>
|
* @param <T> class inherited from {@link Fsm}
|
||||||
*/
|
*/
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface StateHandler<T extends Fsm> {
|
public interface StateHandler<T extends Fsm> {
|
||||||
|
Loading…
Reference in New Issue
Block a user