\ru\ifmo\alarm\Model1EventProcessor.java

/** 
 * This file was generated from model [Model1] on [Sun Dec 11 22:26:56 MSK 2005]. 
 * Do not change content of this file. 
 */ 
 
package ru.ifmo.alarm; 
 
import java.util.*; 
 
import com.evelopers.common.exception.*; 
import com.evelopers.unimod.core.stateworks.*; 
import com.evelopers.unimod.runtime.*; 
import com.evelopers.unimod.runtime.context.*; 
 
public class Model1EventProcessor extends AbstractEventProcessor { 
 
    private ModelStructure modelStructure; 
 
    private static final int A1 = 1; 
 
    private static final int A2 = 2; 
 
    private int decodeStateMachine(String sm) { 
 
        if ("A1".equals(sm)) { 
            return A1; 
        } else 
 
        if ("A2".equals(sm)) { 
            return A2; 
        } 
 
        return -1; 
    } 
 
    private A1EventProcessor _A1; 
 
    private A2EventProcessor _A2; 
 
    public Model1EventProcessor() { 
        modelStructure = new Model1ModelStructure(); 
 
        _A1 = new A1EventProcessor(); 
        _A2 = new A2EventProcessor(); 
    } 
 
    public ModelStructure getModelStructure() { 
        return modelStructure; 
    } 
 
    public void setControlledObjectsMap( 
            ControlledObjectsMap controlledObjectsMap) { 
        super.setControlledObjectsMap(controlledObjectsMap); 
 
        _A1.init(controlledObjectsMap); 
        _A2.init(controlledObjectsMap); 
    } 
 
    protected StateMachineConfig process(Event event, 
            StateMachineContext context, StateMachinePath path, 
            StateMachineConfig config) throws SystemException { 
 
        // get state machine from path 
        int sm = decodeStateMachine(path.getStateMachine()); 
 
        try { 
            switch (sm) { 
            case A1: 
                return _A1.process(event, context, path, config); 
            case A2: 
                return _A2.process(event, context, path, config); 
            default: 
                throw new EventProcessorException("Unknown state machine [" 
                        + path.getStateMachine() + "]"); 
            } 
        } catch (Exception e) { 
            if (e instanceof SystemException) { 
                throw (SystemException) e; 
            } else { 
                throw new SystemException(e); 
            } 
        } 
    } 
 
    protected StateMachineConfig transiteToStableState( 
            StateMachineContext context, StateMachinePath path, 
            StateMachineConfig config) throws SystemException { 
 
        // get state machine from path 
        int sm = decodeStateMachine(path.getStateMachine()); 
 
        try { 
            switch (sm) { 
            case A1: 
                return _A1.transiteToStableState(context, path, config); 
            case A2: 
                return _A2.transiteToStableState(context, path, config); 
            default: 
                throw new EventProcessorException("Unknown state machine [" 
                        + path.getStateMachine() + "]"); 
            } 
        } catch (Exception e) { 
            if (e instanceof SystemException) { 
                throw (SystemException) e; 
            } else { 
                throw new SystemException(e); 
            } 
        } 
    } 
 
    private class Model1ModelStructure implements ModelStructure { 
 
        private Map configManagers = new HashMap(); 
 
        private Model1ModelStructure() { 
            configManagers 
                    .put( 
                            "A1", 
                            new com.evelopers.unimod.runtime.config.DistinguishConfigManager()); 
            configManagers 
                    .put( 
                            "A2", 
                            new com.evelopers.unimod.runtime.config.DistinguishConfigManager()); 
        } 
 
        public StateMachinePath getRootPath() throws EventProcessorException { 
            return new StateMachinePath("A1"); 
        } 
 
        public StateMachineConfigManager getConfigManager(String stateMachine) 
                throws EventProcessorException { 
            return (StateMachineConfigManager) configManagers.get(stateMachine); 
        } 
 
        public StateMachineConfig getTopConfig(String stateMachine) 
                throws EventProcessorException { 
            int sm = decodeStateMachine(stateMachine); 
 
            switch (sm) { 
            case A1: 
                return new StateMachineConfig("Top"); 
            case A2: 
                return new StateMachineConfig("Top"); 
            default: 
                throw new EventProcessorException("Unknown state machine [" 
                        + stateMachine + "]"); 
            } 
        } 
 
        public boolean isFinal(String stateMachine, StateMachineConfig config) 
                throws EventProcessorException { 
            // get state machine from path 
            int sm = decodeStateMachine(stateMachine); 
            int state; 
 
            switch (sm) { 
            case A1: 
                state = _A1.decodeState(config.getActiveState()); 
                switch (state) { 
                case A1EventProcessor.s3: 
                    return true; 
                default: 
                    return false; 
                } 
            case A2: 
                state = _A2.decodeState(config.getActiveState()); 
                switch (state) { 
                default: 
                    return false; 
                } 
            default: 
                throw new EventProcessorException("Unknown state machine [" 
                        + stateMachine + "]"); 
            } 
        } 
    } 
 
    private class A1EventProcessor { 
 
        // states 
        private static final int Top = 1; 
 
        private static final int s3 = 2; 
 
        private static final int _1__Выключена = 3; 
 
        private static final int _2__Включена = 4; 
 
        private static final int _1__Обычное_состояние = 5; 
 
        private static final int _2__Состояние_опасности = 6; 
 
        private static final int _3__Тревога = 7; 
 
        private static final int s2 = 8; 
 
        private static final int s1 = 9; 
 
        private int decodeState(String state) { 
 
            if ("Top".equals(state)) { 
                return Top; 
            } else 
 
            if ("s3".equals(state)) { 
                return s3; 
            } else 
 
            if ("1. Выключена".equals(state)) { 
                return _1__Выключена; 
            } else 
 
            if ("2. Включена".equals(state)) { 
                return _2__Включена; 
            } else 
 
            if ("1. Обычное состояние".equals(state)) { 
                return _1__Обычное_состояние; 
            } else 
 
            if ("2. Состояние опасности".equals(state)) { 
                return _2__Состояние_опасности; 
            } else 
 
            if ("3. Тревога".equals(state)) { 
                return _3__Тревога; 
            } else 
 
            if ("s2".equals(state)) { 
                return s2; 
            } else 
 
            if ("s1".equals(state)) { 
                return s1; 
            } 
 
            return -1; 
        } 
 
        // events 
        private static final int e33 = 1; 
 
        private static final int e22 = 2; 
 
        private static final int e11 = 3; 
 
        private static final int e34 = 4; 
 
        private static final int e32 = 5; 
 
        private static final int e21 = 6; 
 
        private static final int e12 = 7; 
 
        private int decodeEvent(String event) { 
 
            if ("e33".equals(event)) { 
                return e33; 
            } else 
 
            if ("e22".equals(event)) { 
                return e22; 
            } else 
 
            if ("e11".equals(event)) { 
                return e11; 
            } else 
 
            if ("e34".equals(event)) { 
                return e34; 
            } else 
 
            if ("e32".equals(event)) { 
                return e32; 
            } else 
 
            if ("e21".equals(event)) { 
                return e21; 
            } else 
 
            if ("e12".equals(event)) { 
                return e12; 
            } 
 
            return -1; 
        } 
 
        private ru.ifmo.alarm.controlled.Commentator o5; 
 
        private ru.ifmo.alarm.controlled.LightDiode o4; 
 
        private ru.ifmo.alarm.controlled.Sounds o3; 
 
        private ru.ifmo.alarm.controlled.Lights o1; 
 
        private ru.ifmo.alarm.controlled.StateTimerStarter o2; 
 
        private void init(ControlledObjectsMap controlledObjectsMap) { 
            o5 = (ru.ifmo.alarm.controlled.Commentator) controlledObjectsMap 
                    .getControlledObject("o5"); 
            o4 = (ru.ifmo.alarm.controlled.LightDiode) controlledObjectsMap 
                    .getControlledObject("o4"); 
            o3 = (ru.ifmo.alarm.controlled.Sounds) controlledObjectsMap 
                    .getControlledObject("o3"); 
            o1 = (ru.ifmo.alarm.controlled.Lights) controlledObjectsMap 
                    .getControlledObject("o1"); 
            o2 = (ru.ifmo.alarm.controlled.StateTimerStarter) controlledObjectsMap 
                    .getControlledObject("o2"); 
        } 
 
        private StateMachineConfig process(Event event, 
                StateMachineContext context, StateMachinePath path, 
                StateMachineConfig config) throws Exception { 
            config = lookForTransition(event, context, path, config); 
 
            config = transiteToStableState(context, path, config); 
 
            // execute included state machines 
            executeSubmachines(event, context, path, config); 
 
            return config; 
        } 
 
        private void executeSubmachines(Event event, 
                StateMachineContext context, StateMachinePath path, 
                StateMachineConfig config) throws Exception { 
            int state = decodeState(config.getActiveState()); 
 
            while (true) { 
                switch (state) { 
                case s3: 
 
                    return; 
                case _1__Выключена: 
                    // 1. Выключена includes A2 
 
                    fireBeforeSubmachineExecution(context, event, path, 
                            "1. Выключена", "A2"); 
 
                    Model1EventProcessor.this.process(event, context, 
                            new StateMachinePath(path, "1. Выключена", "A2")); 
 
                    fireAfterSubmachineExecution(context, event, path, 
                            "1. Выключена", "A2"); 
 
                    return; 
                case _2__Включена: 
                    // 2. Включена includes A2 
 
                    fireBeforeSubmachineExecution(context, event, path, 
                            "2. Включена", "A2"); 
 
                    Model1EventProcessor.this.process(event, context, 
                            new StateMachinePath(path, "2. Включена", "A2")); 
 
                    fireAfterSubmachineExecution(context, event, path, 
                            "2. Включена", "A2"); 
 
                    return; 
                case _1__Обычное_состояние: 
 
                    state = _2__Включена; 
                    break; 
                case _2__Состояние_опасности: 
 
                    state = _2__Включена; 
                    break; 
                case _3__Тревога: 
 
                    state = _2__Включена; 
                    break; 
                case s2: 
 
                    state = _2__Включена; 
                    break; 
                case s1: 
 
                    return; 
                default: 
                    throw new EventProcessorException("State with name [" 
                            + config.getActiveState() 
                            + "] is unknown for state machine [A1]"); 
                } 
            } 
        } 
 
        private StateMachineConfig transiteToStableState( 
                StateMachineContext context, StateMachinePath path, 
                StateMachineConfig config) throws Exception { 
 
            int s = decodeState(config.getActiveState()); 
            Event event; 
 
            switch (s) { 
            case Top: 
 
                fireComeToState(context, path, "s1"); 
 
                // s1->1. Выключена [true]/ 
                event = Event.NO_EVENT; 
                fireTransitionFound(context, path, "s1", event, 
                        "s1#1. Выключена##true"); 
 
                fireComeToState(context, path, "1. Выключена"); 
 
                // 1. Выключена [] 
 
                return new StateMachineConfig("1. Выключена"); 
            case _2__Включена: 
                fireCompositeTargetState(context, path, "2. Включена"); 
 
                fireComeToState(context, path, "s2"); 
 
                // s2->1. Обычное состояние [true]/ 
                event = Event.NO_EVENT; 
                fireTransitionFound(context, path, "s2", event, 
                        "s2#1. Обычное состояние##true"); 
 
                fireComeToState(context, path, "1. Обычное состояние"); 
 
                // 1. Обычное состояние [] 
 
                return new StateMachineConfig("1. Обычное состояние"); 
            } 
 
            return config; 
        } 
 
        private StateMachineConfig lookForTransition(Event event, 
                StateMachineContext context, StateMachinePath path, 
                StateMachineConfig config) throws Exception { 
 
            boolean 
 
            o3_x1 = false; 
 
            BitSet calculatedInputActions = new BitSet(1); 
 
            int s = decodeState(config.getActiveState()); 
            int e = decodeEvent(event.getName()); 
 
            while (true) { 
                switch (s) { 
                case _1__Выключена: 
 
                    switch (e) { 
                    case e11: 
 
                        // 1. Выключена->2. Включена 
                        // e11[!o3.x1]/o1.z1,o3.z5,o4.z1,o5.z1,o2.z4,o3.z6 
 
                        fireTransitionCandidate(context, path, "1. Выключена", 
                                event, "1. Выключена#2. Включена#e11#!o3.x1"); 
 
                        if (!isInputActionCalculated(calculatedInputActions, 
                                _o3_x1)) { 
 
                            fireBeforeInputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o3.x1"); 
 
                            o3_x1 = o3.x1(context); 
 
                            fireAfterInputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o3.x1", new Boolean(o3_x1)); 
                        } 
 
                        if (!o3_x1) { 
 
                            fireTransitionFound(context, path, "1. Выключена", 
                                    event, 
                                    "1. Выключена#2. Включена#e11#!o3.x1"); 
 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o1.z1"); 
 
                            o1.z1(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o1.z1"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o3.z5"); 
 
                            o3.z5(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o3.z5"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o4.z1"); 
 
                            o4.z1(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o4.z1"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o5.z1"); 
 
                            o5.z1(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o5.z1"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o2.z4"); 
 
                            o2.z4(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o2.z4"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o3.z6"); 
 
                            o3.z6(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#!o3.x1", 
                                    "o3.z6"); 
 
                            fireComeToState(context, path, "2. Включена"); 
 
                            // 2. Включена [] 
                            return new StateMachineConfig("2. Включена"); 
 
                        } 
                        // 1. Выключена->2. Включена 
                        // e11[o3.x1]/o1.z1,o3.z1,o4.z1,o5.z1,o2.z4,o3.z6 
 
                        fireTransitionCandidate(context, path, "1. Выключена", 
                                event, "1. Выключена#2. Включена#e11#o3.x1"); 
 
                        if (o3_x1) { 
 
                            fireTransitionFound(context, path, "1. Выключена", 
                                    event, "1. Выключена#2. Включена#e11#o3.x1"); 
 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o1.z1"); 
 
                            o1.z1(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o1.z1"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o3.z1"); 
 
                            o3.z1(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o3.z1"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o4.z1"); 
 
                            o4.z1(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o4.z1"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o5.z1"); 
 
                            o5.z1(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o5.z1"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o2.z4"); 
 
                            o2.z4(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o2.z4"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o3.z6"); 
 
                            o3.z6(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "1. Выключена#2. Включена#e11#o3.x1", 
                                    "o3.z6"); 
 
                            fireComeToState(context, path, "2. Включена"); 
 
                            // 2. Включена [] 
                            return new StateMachineConfig("2. Включена"); 
 
                        } 
 
                        // transition not found 
                        return config; 
                    case e34: 
 
                        // 1. Выключена->s3 e34[true]/o2.z4,o1.z5,o3.z5 
 
                        fireTransitionCandidate(context, path, "1. Выключена", 
                                event, "1. Выключена#s3#e34#true"); 
 
                        fireTransitionFound(context, path, "1. Выключена", 
                                event, "1. Выключена#s3#e34#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Выключена#s3#e34#true", "o2.z4"); 
 
                        o2.z4(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Выключена#s3#e34#true", "o2.z4"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Выключена#s3#e34#true", "o1.z5"); 
 
                        o1.z5(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Выключена#s3#e34#true", "o1.z5"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Выключена#s3#e34#true", "o3.z5"); 
 
                        o3.z5(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Выключена#s3#e34#true", "o3.z5"); 
 
                        fireComeToState(context, path, "s3"); 
 
                        // s3 [] 
                        return new StateMachineConfig("s3"); 
 
                    default: 
 
                        // transition not found 
                        return config; 
                    } 
 
                case _2__Включена: 
 
                    fireTransitionsOfSuperstate(context, path, "2. Включена", 
                            event); 
 
                    switch (e) { 
                    case e34: 
 
                        // 2. Включена->s3 e34[true]/o2.z4,o1.z5,o3.z5 
 
                        fireTransitionCandidate(context, path, "2. Включена", 
                                event, "2. Включена#s3#e34#true"); 
 
                        fireTransitionFound(context, path, "2. Включена", 
                                event, "2. Включена#s3#e34#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Включена#s3#e34#true", "o2.z4"); 
 
                        o2.z4(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Включена#s3#e34#true", "o2.z4"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Включена#s3#e34#true", "o1.z5"); 
 
                        o1.z5(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Включена#s3#e34#true", "o1.z5"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Включена#s3#e34#true", "o3.z5"); 
 
                        o3.z5(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Включена#s3#e34#true", "o3.z5"); 
 
                        fireComeToState(context, path, "s3"); 
 
                        // s3 [] 
                        return new StateMachineConfig("s3"); 
 
                    case e12: 
 
                        // 2. Включена->1. Выключена 
                        // e12[o3.x1]/o1.z2,o3.z2,o4.z2,o5.z2,o2.z4,o3.z6 
 
                        fireTransitionCandidate(context, path, "2. Включена", 
                                event, "2. Включена#1. Выключена#e12#o3.x1"); 
 
                        if (!isInputActionCalculated(calculatedInputActions, 
                                _o3_x1)) { 
 
                            fireBeforeInputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o3.x1"); 
 
                            o3_x1 = o3.x1(context); 
 
                            fireAfterInputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o3.x1", new Boolean(o3_x1)); 
                        } 
 
                        if (o3_x1) { 
 
                            fireTransitionFound(context, path, "2. Включена", 
                                    event, "2. Включена#1. Выключена#e12#o3.x1"); 
 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o1.z2"); 
 
                            o1.z2(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o1.z2"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o3.z2"); 
 
                            o3.z2(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o3.z2"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o4.z2"); 
 
                            o4.z2(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o4.z2"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o5.z2"); 
 
                            o5.z2(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o5.z2"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o2.z4"); 
 
                            o2.z4(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o2.z4"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o3.z6"); 
 
                            o3.z6(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#o3.x1", 
                                    "o3.z6"); 
 
                            fireComeToState(context, path, "1. Выключена"); 
 
                            // 1. Выключена [] 
                            return new StateMachineConfig("1. Выключена"); 
 
                        } 
                        // 2. Включена->1. Выключена 
                        // e12[!o3.x1]/o1.z2,o3.z5,o4.z2,o5.z2,o2.z4,o3.z6 
 
                        fireTransitionCandidate(context, path, "2. Включена", 
                                event, "2. Включена#1. Выключена#e12#!o3.x1"); 
 
                        if (!o3_x1) { 
 
                            fireTransitionFound(context, path, "2. Включена", 
                                    event, 
                                    "2. Включена#1. Выключена#e12#!o3.x1"); 
 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o1.z2"); 
 
                            o1.z2(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o1.z2"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o3.z5"); 
 
                            o3.z5(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o3.z5"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o4.z2"); 
 
                            o4.z2(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o4.z2"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o5.z2"); 
 
                            o5.z2(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o5.z2"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o2.z4"); 
 
                            o2.z4(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o2.z4"); 
                            fireBeforeOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o3.z6"); 
 
                            o3.z6(context); 
 
                            fireAfterOutputActionExecution(context, path, 
                                    "2. Включена#1. Выключена#e12#!o3.x1", 
                                    "o3.z6"); 
 
                            fireComeToState(context, path, "1. Выключена"); 
 
                            // 1. Выключена [] 
                            return new StateMachineConfig("1. Выключена"); 
 
                        } 
 
                        // transition not found 
                        return config; 
                    default: 
 
                        // transition not found 
                        return config; 
                    } 
 
                case _1__Обычное_состояние: 
 
                    switch (e) { 
                    case e22: 
 
                        // 1. Обычное состояние->3. Тревога 
                        // e22[true]/o5.z6,o2.z1,o1.z4,o3.z4,o5.z9 
 
                        fireTransitionCandidate(context, path, 
                                "1. Обычное состояние", event, 
                                "1. Обычное состояние#3. Тревога#e22#true"); 
 
                        fireTransitionFound(context, path, 
                                "1. Обычное состояние", event, 
                                "1. Обычное состояние#3. Тревога#e22#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o5.z6"); 
 
                        o5.z6(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o5.z6"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o2.z1"); 
 
                        o2.z1(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o2.z1"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o1.z4"); 
 
                        o1.z4(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o1.z4"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o3.z4"); 
 
                        o3.z4(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o3.z4"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o5.z9"); 
 
                        o5.z9(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Обычное состояние#3. Тревога#e22#true", 
                                "o5.z9"); 
 
                        fireComeToState(context, path, "3. Тревога"); 
 
                        // 3. Тревога [] 
                        return new StateMachineConfig("3. Тревога"); 
 
                    case e34: 
 
                        // go to super state only if it process given event or 
                        // any event 
                        s = _2__Включена; 
                        break; 
                    case e21: 
 
                        // 1. Обычное состояние->2. Состояние опасности 
                        // e21[true]/o5.z5,o1.z3,o3.z3,o2.z2,o5.z7 
 
                        fireTransitionCandidate(context, path, 
                                "1. Обычное состояние", event, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true"); 
 
                        fireTransitionFound(context, path, 
                                "1. Обычное состояние", event, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true"); 
 
                        fireBeforeOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o5.z5"); 
 
                        o5.z5(context); 
 
                        fireAfterOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o5.z5"); 
                        fireBeforeOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o1.z3"); 
 
                        o1.z3(context); 
 
                        fireAfterOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o1.z3"); 
                        fireBeforeOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o3.z3"); 
 
                        o3.z3(context); 
 
                        fireAfterOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o3.z3"); 
                        fireBeforeOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o2.z2"); 
 
                        o2.z2(context); 
 
                        fireAfterOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o2.z2"); 
                        fireBeforeOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o5.z7"); 
 
                        o5.z7(context); 
 
                        fireAfterOutputActionExecution( 
                                context, 
                                path, 
                                "1. Обычное состояние#2. Состояние опасности#e21#true", 
                                "o5.z7"); 
 
                        fireComeToState(context, path, "2. Состояние опасности"); 
 
                        // 2. Состояние опасности [] 
                        return new StateMachineConfig("2. Состояние опасности"); 
 
                    case e12: 
 
                        // go to super state only if it process given event or 
                        // any event 
                        s = _2__Включена; 
                        break; 
                    default: 
 
                        // go to super state only if it process given event or 
                        // any event 
                        // transition not found 
                        return config; 
                    } 
 
                    break; 
                case _2__Состояние_опасности: 
 
                    switch (e) { 
                    case e22: 
 
                        // 2. Состояние опасности->3. Тревога 
                        // e22[true]/o2.z1,o1.z4,o3.z4,o5.z6,o5.z9 
 
                        fireTransitionCandidate(context, path, 
                                "2. Состояние опасности", event, 
                                "2. Состояние опасности#3. Тревога#e22#true"); 
 
                        fireTransitionFound(context, path, 
                                "2. Состояние опасности", event, 
                                "2. Состояние опасности#3. Тревога#e22#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o2.z1"); 
 
                        o2.z1(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o2.z1"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o1.z4"); 
 
                        o1.z4(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o1.z4"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o3.z4"); 
 
                        o3.z4(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o3.z4"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o5.z6"); 
 
                        o5.z6(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o5.z6"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o5.z9"); 
 
                        o5.z9(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e22#true", 
                                "o5.z9"); 
 
                        fireComeToState(context, path, "3. Тревога"); 
 
                        // 3. Тревога [] 
                        return new StateMachineConfig("3. Тревога"); 
 
                    case e34: 
 
                        // go to super state only if it process given event or 
                        // any event 
                        s = _2__Включена; 
                        break; 
                    case e32: 
 
                        // 2. Состояние опасности->1. Обычное состояние 
                        // e32[true]/o5.z8 
 
                        fireTransitionCandidate(context, path, 
                                "2. Состояние опасности", event, 
                                "2. Состояние опасности#1. Обычное состояние#e32#true"); 
 
                        fireTransitionFound(context, path, 
                                "2. Состояние опасности", event, 
                                "2. Состояние опасности#1. Обычное состояние#e32#true"); 
 
                        fireBeforeOutputActionExecution( 
                                context, 
                                path, 
                                "2. Состояние опасности#1. Обычное состояние#e32#true", 
                                "o5.z8"); 
 
                        o5.z8(context); 
 
                        fireAfterOutputActionExecution( 
                                context, 
                                path, 
                                "2. Состояние опасности#1. Обычное состояние#e32#true", 
                                "o5.z8"); 
 
                        fireComeToState(context, path, "1. Обычное состояние"); 
 
                        // 1. Обычное состояние [] 
                        return new StateMachineConfig("1. Обычное состояние"); 
 
                    case e21: 
 
                        // 2. Состояние опасности->3. Тревога e21[true]/o2.z1,o1.z4,o3.z4,o5.z5,o5.z9 
 
                        fireTransitionCandidate(context, path, 
                                "2. Состояние опасности", event, 
                                "2. Состояние опасности#3. Тревога#e21#true"); 
 
                        fireTransitionFound(context, path, 
                                "2. Состояние опасности", event, 
                                "2. Состояние опасности#3. Тревога#e21#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o2.z1"); 
 
                        o2.z1(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o2.z1"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o1.z4"); 
 
                        o1.z4(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o1.z4"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o3.z4"); 
 
                        o3.z4(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o3.z4"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o5.z5"); 
 
                        o5.z5(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o5.z5"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o5.z9"); 
 
                        o5.z9(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Состояние опасности#3. Тревога#e21#true", 
                                "o5.z9"); 
 
                        fireComeToState(context, path, "3. Тревога"); 
 
                        // 3. Тревога [] 
                        return new StateMachineConfig("3. Тревога"); 
 
                    case e12: 
 
                        // go to super state only if it process given event or any event 
                        s = _2__Включена; 
                        break; 
                    default: 
 
                        // go to super state only if it process given event or any event 
                        // transition not found 
                        return config; 
                    } 
 
                    break; 
                case _3__Тревога: 
 
                    switch (e) { 
                    case e33: 
 
                        // 3. Тревога->1. Обычное состояние e33[true]/o1.z5,o3.z5,o5.z10 
 
                        fireTransitionCandidate(context, path, "3. Тревога", 
                                event, 
                                "3. Тревога#1. Обычное состояние#e33#true"); 
 
                        fireTransitionFound(context, path, "3. Тревога", event, 
                                "3. Тревога#1. Обычное состояние#e33#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "3. Тревога#1. Обычное состояние#e33#true", 
                                "o1.z5"); 
 
                        o1.z5(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "3. Тревога#1. Обычное состояние#e33#true", 
                                "o1.z5"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "3. Тревога#1. Обычное состояние#e33#true", 
                                "o3.z5"); 
 
                        o3.z5(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "3. Тревога#1. Обычное состояние#e33#true", 
                                "o3.z5"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "3. Тревога#1. Обычное состояние#e33#true", 
                                "o5.z10"); 
 
                        o5.z10(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "3. Тревога#1. Обычное состояние#e33#true", 
                                "o5.z10"); 
 
                        fireComeToState(context, path, "1. Обычное состояние"); 
 
                        // 1. Обычное состояние [] 
                        return new StateMachineConfig("1. Обычное состояние"); 
 
                    case e22: 
 
                        // 3. Тревога->3. Тревога e22[true]/o5.z6 
 
                        fireTransitionCandidate(context, path, "3. Тревога", 
                                event, "3. Тревога#3. Тревога#e22#true"); 
 
                        fireTransitionFound(context, path, "3. Тревога", event, 
                                "3. Тревога#3. Тревога#e22#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "3. Тревога#3. Тревога#e22#true", "o5.z6"); 
 
                        o5.z6(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "3. Тревога#3. Тревога#e22#true", "o5.z6"); 
 
                        fireComeToState(context, path, "3. Тревога"); 
 
                        // 3. Тревога [] 
                        return new StateMachineConfig("3. Тревога"); 
 
                    case e34: 
 
                        // go to super state only if it process given event or any event 
                        s = _2__Включена; 
                        break; 
                    case e21: 
 
                        // 3. Тревога->3. Тревога e21[true]/o5.z5 
 
                        fireTransitionCandidate(context, path, "3. Тревога", 
                                event, "3. Тревога#3. Тревога#e21#true"); 
 
                        fireTransitionFound(context, path, "3. Тревога", event, 
                                "3. Тревога#3. Тревога#e21#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "3. Тревога#3. Тревога#e21#true", "o5.z5"); 
 
                        o5.z5(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "3. Тревога#3. Тревога#e21#true", "o5.z5"); 
 
                        fireComeToState(context, path, "3. Тревога"); 
 
                        // 3. Тревога [] 
                        return new StateMachineConfig("3. Тревога"); 
 
                    case e12: 
 
                        // go to super state only if it process given event or any event 
                        s = _2__Включена; 
                        break; 
                    default: 
 
                        // go to super state only if it process given event or any event 
                        // transition not found 
                        return config; 
                    } 
 
                    break; 
                default: 
                    throw new EventProcessorException( 
                            "Incorrect stable state [" 
                                    + config.getActiveState() 
                                    + "] in state machine [A1]"); 
                } 
            } 
        } 
 
        //o3.x1 
        private static final int _o3_x1 = 0; 
 
    } 
 
    private class A2EventProcessor { 
 
        // states 
        private static final int Top = 1; 
 
        private static final int _2__Звук_выключен = 2; 
 
        private static final int _1__Звук_включен = 3; 
 
        private static final int s1 = 4; 
 
        private int decodeState(String state) { 
 
            if ("Top".equals(state)) { 
                return Top; 
            } else 
 
            if ("2. Звук выключен".equals(state)) { 
                return _2__Звук_выключен; 
            } else 
 
            if ("1. Звук включен".equals(state)) { 
                return _1__Звук_включен; 
            } else 
 
            if ("s1".equals(state)) { 
                return s1; 
            } 
 
            return -1; 
        } 
 
        // events 
        private static final int e31 = 1; 
 
        private static final int e13 = 2; 
 
        private static final int e11 = 3; 
 
        private static final int e12 = 4; 
 
        private int decodeEvent(String event) { 
 
            if ("e31".equals(event)) { 
                return e31; 
            } else 
 
            if ("e13".equals(event)) { 
                return e13; 
            } else 
 
            if ("e11".equals(event)) { 
                return e11; 
            } else 
 
            if ("e12".equals(event)) { 
                return e12; 
            } 
 
            return -1; 
        } 
 
        private ru.ifmo.alarm.controlled.Commentator o5; 
 
        private ru.ifmo.alarm.controlled.StateTimerStarter o2; 
 
        private ru.ifmo.alarm.controlled.Sounds o3; 
 
        private ru.ifmo.alarm.controlled.Lights o1; 
 
        private void init(ControlledObjectsMap controlledObjectsMap) { 
            o5 = (ru.ifmo.alarm.controlled.Commentator) controlledObjectsMap 
                    .getControlledObject("o5"); 
            o2 = (ru.ifmo.alarm.controlled.StateTimerStarter) controlledObjectsMap 
                    .getControlledObject("o2"); 
            o3 = (ru.ifmo.alarm.controlled.Sounds) controlledObjectsMap 
                    .getControlledObject("o3"); 
            o1 = (ru.ifmo.alarm.controlled.Lights) controlledObjectsMap 
                    .getControlledObject("o1"); 
        } 
 
        private StateMachineConfig process(Event event, 
                StateMachineContext context, StateMachinePath path, 
                StateMachineConfig config) throws Exception { 
            config = lookForTransition(event, context, path, config); 
 
            config = transiteToStableState(context, path, config); 
 
            // execute included state machines 
            executeSubmachines(event, context, path, config); 
 
            return config; 
        } 
 
        private void executeSubmachines(Event event, 
                StateMachineContext context, StateMachinePath path, 
                StateMachineConfig config) throws Exception { 
            int state = decodeState(config.getActiveState()); 
 
            while (true) { 
                switch (state) { 
                case _2__Звук_выключен: 
 
                    return; 
                case _1__Звук_включен: 
 
                    return; 
                case s1: 
 
                    return; 
                default: 
                    throw new EventProcessorException("State with name [" 
                            + config.getActiveState() 
                            + "] is unknown for state machine [A2]"); 
                } 
            } 
        } 
 
        private StateMachineConfig transiteToStableState( 
                StateMachineContext context, StateMachinePath path, 
                StateMachineConfig config) throws Exception { 
 
            int s = decodeState(config.getActiveState()); 
            Event event; 
 
            switch (s) { 
            case Top: 
 
                fireComeToState(context, path, "s1"); 
 
                // s1->1. Звук включен [true]/ 
                event = Event.NO_EVENT; 
                fireTransitionFound(context, path, "s1", event, 
                        "s1#1. Звук включен##true"); 
 
                fireComeToState(context, path, "1. Звук включен"); 
 
                // 1. Звук включен [] 
 
                return new StateMachineConfig("1. Звук включен"); 
            } 
 
            return config; 
        } 
 
        private StateMachineConfig lookForTransition(Event event, 
                StateMachineContext context, StateMachinePath path, 
                StateMachineConfig config) throws Exception { 
 
            BitSet calculatedInputActions = new BitSet(0); 
 
            int s = decodeState(config.getActiveState()); 
            int e = decodeEvent(event.getName()); 
 
            while (true) { 
                switch (s) { 
                case _2__Звук_выключен: 
 
                    switch (e) { 
                    case e31: 
 
                        // 2. Звук выключен->1. Звук включен e31[true]/o5.z4,o3.z6 
 
                        fireTransitionCandidate(context, path, 
                                "2. Звук выключен", event, 
                                "2. Звук выключен#1. Звук включен#e31#true"); 
 
                        fireTransitionFound(context, path, "2. Звук выключен", 
                                event, 
                                "2. Звук выключен#1. Звук включен#e31#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Звук выключен#1. Звук включен#e31#true", 
                                "o5.z4"); 
 
                        o5.z4(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Звук выключен#1. Звук включен#e31#true", 
                                "o5.z4"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Звук выключен#1. Звук включен#e31#true", 
                                "o3.z6"); 
 
                        o3.z6(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Звук выключен#1. Звук включен#e31#true", 
                                "o3.z6"); 
 
                        fireComeToState(context, path, "1. Звук включен"); 
 
                        // 1. Звук включен [] 
                        return new StateMachineConfig("1. Звук включен"); 
 
                    case e11: 
 
                        // 2. Звук выключен->1. Звук включен e11[true]/o3.z6 
 
                        fireTransitionCandidate(context, path, 
                                "2. Звук выключен", event, 
                                "2. Звук выключен#1. Звук включен#e11#true"); 
 
                        fireTransitionFound(context, path, "2. Звук выключен", 
                                event, 
                                "2. Звук выключен#1. Звук включен#e11#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Звук выключен#1. Звук включен#e11#true", 
                                "o3.z6"); 
 
                        o3.z6(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Звук выключен#1. Звук включен#e11#true", 
                                "o3.z6"); 
 
                        fireComeToState(context, path, "1. Звук включен"); 
 
                        // 1. Звук включен [] 
                        return new StateMachineConfig("1. Звук включен"); 
 
                    case e12: 
 
                        // 2. Звук выключен->1. Звук включен e12[true]/o3.z6 
 
                        fireTransitionCandidate(context, path, 
                                "2. Звук выключен", event, 
                                "2. Звук выключен#1. Звук включен#e12#true"); 
 
                        fireTransitionFound(context, path, "2. Звук выключен", 
                                event, 
                                "2. Звук выключен#1. Звук включен#e12#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "2. Звук выключен#1. Звук включен#e12#true", 
                                "o3.z6"); 
 
                        o3.z6(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "2. Звук выключен#1. Звук включен#e12#true", 
                                "o3.z6"); 
 
                        fireComeToState(context, path, "1. Звук включен"); 
 
                        // 1. Звук включен [] 
                        return new StateMachineConfig("1. Звук включен"); 
 
                    default: 
 
                        // transition not found 
                        return config; 
                    } 
 
                case _1__Звук_включен: 
 
                    switch (e) { 
                    case e13: 
 
                        // 1. Звук включен->2. Звук выключен e13[true]/o2.z3,o5.z3,o3.z7 
 
                        fireTransitionCandidate(context, path, 
                                "1. Звук включен", event, 
                                "1. Звук включен#2. Звук выключен#e13#true"); 
 
                        fireTransitionFound(context, path, "1. Звук включен", 
                                event, 
                                "1. Звук включен#2. Звук выключен#e13#true"); 
 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Звук включен#2. Звук выключен#e13#true", 
                                "o2.z3"); 
 
                        o2.z3(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Звук включен#2. Звук выключен#e13#true", 
                                "o2.z3"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Звук включен#2. Звук выключен#e13#true", 
                                "o5.z3"); 
 
                        o5.z3(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Звук включен#2. Звук выключен#e13#true", 
                                "o5.z3"); 
                        fireBeforeOutputActionExecution(context, path, 
                                "1. Звук включен#2. Звук выключен#e13#true", 
                                "o3.z7"); 
 
                        o3.z7(context); 
 
                        fireAfterOutputActionExecution(context, path, 
                                "1. Звук включен#2. Звук выключен#e13#true", 
                                "o3.z7"); 
 
                        fireComeToState(context, path, "2. Звук выключен"); 
 
                        // 2. Звук выключен [] 
                        return new StateMachineConfig("2. Звук выключен"); 
 
                    default: 
 
                        // transition not found 
                        return config; 
                    } 
 
                default: 
                    throw new EventProcessorException( 
                            "Incorrect stable state [" 
                                    + config.getActiveState() 
                                    + "] in state machine [A2]"); 
                } 
            } 
        } 
 
    } 
 
    private static boolean isInputActionCalculated( 
            BitSet calculatedInputActions, int k) { 
        boolean b = calculatedInputActions.get(k); 
 
        if (!b) { 
            calculatedInputActions.set(k); 
        } 
 
        return b; 
    } 
 
}