Finite state machine: Difference between revisions

m (→‎{{header|C}}: Remove vanity tags)
Line 328:
public class FiniteStateMachine {
 
private enum StateStateBall {
ReadyOUTGREEN(true, "Deposit", "QuitChangeState"),
WaitingGOAL(true, "Select", "RefundnoKeep"),
DispensingPass(true, "RemovenoKick"),
RefundingKick(false, "RefundingYES"),
ExitingOUTPOSESSION(false, "QuitingChangeState");
Shoot(false, "VS"); //N.*USA CYBER COMMENT: our solution have only one state true
 
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.?
State(boolean exp, String... in) {
inputs = Arrays.asList(in);
explicit = exp;
}
 
State nextState(String input, StateStateBall current) {
if (inputs.contains(input)) {
return map.getOrDefault(input, current);
Anonymous user