-
Notifications
You must be signed in to change notification settings - Fork 1
/
HFSM.java
88 lines (64 loc) · 1.59 KB
/
HFSM.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package jab.lejos.liverobots.hfsm;
import jab.lejos.liverobots.fsm.FSM;
import jab.lejos.liverobots.hfsm.Transitions;
import java.io.File;
import java.net.MalformedURLException;
import org.apache.log4j.Logger;
/**
*
* @author jabrena
*
*/
public class HFSM extends FSM{
Logger logger = Logger.getLogger(HFSM.class);
private static final String SCXML_CONFIG = "./lib/hfsm.scxml";
public HFSM() throws MalformedURLException{
super(new File(SCXML_CONFIG).toURI().toURL());
}
private Transitions status = null;
public Transitions getStatus(){
return status;
}
public void setStatus(Transitions status){
this.status = status;
}
public void autoFireEvent() {
this.fireEvent(this.getStatus().toString());
}
//HFSM Methods
public void fsm1() {
Logger logger = Logger.getLogger(HFSM.class);
logger.info("STATE: fsm1");
}
public void fsm2() {
logger.info("STATE: fsm2");
}
public void fsm3() {
logger.info("STATE: fsm3");
}
public void State1() {
Logger logger = Logger.getLogger(HFSM.class);
logger.info("STATE: State1");
this.setStatus(Transitions.goState2);
}
public void State2() {
logger.info("STATE: State2");
this.setStatus(Transitions.goFSM2);
}
public void State3() {
logger.info("STATE: State3");
this.setStatus(Transitions.goState4);
}
public void State4() {
logger.info("STATE: State4");
this.setStatus(Transitions.goFSM3);
}
public void State5() {
logger.info("STATE: State5");
this.setStatus(Transitions.goState6);
}
public void State6() {
logger.info("STATE: State6");
this.setStatus(Transitions.goFSM1);
}
}