Finite state machine: Difference between revisions

m
Reverted edits by 7beckham (talk) to last revision by Thundergnat
m (Reverted edits by 7beckham (talk) to last revision by Thundergnat)
Line 328:
public class FiniteStateMachine {
 
private enum StateBallState {
OUTGREENReady(true, "ChangeStateDeposit", "Quit"),
GOALWaiting(true, "noKeepSelect", "Refund"),
PassDispensing(true, "noKickRemove"),
KickRefunding(false, "YESRefunding"),
OUTPOSESSIONExiting(false, "ChangeStateQuiting");
Shoot(false, "VS"); //N.*USA CYBER COMMENT: our solution have only one state true
 
State(boolean exp, String... in) {
State(boolean exp, String... in) { //N.*USA CYBER COMMENT: for unlimited String.N.2: possible our solution invoque //method by name built from String very deprecated becouse no haking in work.solution: Table Method SO.?
inputs = Arrays.asList(in);
explicit = exp;
}
 
State nextState(String input, StateBallState current) {
if (inputs.contains(input)) {
return map.getOrDefault(input, current);
10,333

edits