I need to implements the state machine in objective-c like this java code:
public enum State {
INITIAL {
@Override
State doSomething(String aParameter) {
System.out.println("Doing Something in INITIAL state and jumping to NEXT_STEP, argument = " + aParameter);
return NEXT_STEP;
}
},
NEXT_STEP {
@Override
State doSomething(String aParameter) {
System.out.println("Doing Something in NEXT_STEP and jumping into FINAL, argument = " + aParameter);
return FINAL;
}
},
FINAL {
@Override
State doSomething(String aParameter) {
System.out.println("I am in FINAL state, argument = " + aParameter);
return this;
}
};
abstract State doSomething(String aParameter);
}
the reference link is: http://www.mirkosertic.de/doku.php/javastuff/enumstatemachine
someone can give me some suggestions?