SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы

Назад

Conditions for Transition


Метки: python

In the state transition diagram, an input is tested to see if it meets the condition necessary to transfer to the state under question. As before, the Input is just a tagging interface:

# StateMachine/stateMachine2/Input.py
# Inputs to a state machine

class Input: pass

The Condition evaluates the Input to decide whether this row in the table is the correct transition:

# StateMachine/stateMachine2/Condition.py
# Condition function object for state machine

class Condition:
    boolean condition(input) :
        assert 0, "condition() not implemented"