Add a new abstraction for state machines

Most of the devices behave as state machines. Instead of coding many
times the same class layout for them, such behavior has been refactored
in a `StateMachine` class.
Introduce `EventChannelProvider` trait

The trait `ConditionEvaluator` depends on an access to a `EventChannel`
object in order to subscribe to the events it is evaluating. So far
the `EventChannel` object was required to be provided by the class that
extends the trait.

It’s better to define a self-annotation in `ConditionEvaluator` respect
a new trait `EventChannelProvider`, which provides access to a
`EventChannel` object. By making `SimulationContextAware` trait to
extend `EventChannelProvider`, and `Device` to extend
`SimulationContextAware`, all devices are able to provide the
`EventChannel` object needed by `ConditionEvaluator` without additional
declarations.
Apply state machine trait to `Switch`