Hello,
I just want to try to implement a simple State Machine and I'm reasoning whch class I need
I dont' know if it's clear what I need to do; what it's not clear to me is how design the things! What must Event class contain? Must each state contain a table like 'for each event says which is the target state' ? . Any helps?
thanks
I just want to try to implement a simple State Machine and I'm reasoning whch class I need
Code:
function Machine(startState) {
this.startState = new State(startState);
//states list
this.raise= function(eventName) {
//alert(eventName);
}
}
function State(idState) {
this.id = idState;
//actions list
}
function Event(eventName) {
}
function Action() {
//execute code
}
thanks
Comment