+ case STATE_DOWN:
+ switch (e)
+ {
+ case EVT_DOWN:
+ state_ = STATE_DOWN;
+ transition_move_down ();
+ break;
+ case EVT_OPEN_DOOR:
+ state_ = STATE_OPEN_DOOR;
+ transition_open_door ();
+ break;
+ default:
+ bad_transition (state_, e);
+ break;
+ } // end switch (e)
+ break;
+
+ case STATE_WAIT:
+ switch (e)
+ {
+ case EVT_WAIT:
+ state_ = STATE_WAIT;
+ transition_continue_wait ();
+ break;
+ case EVT_CLOSE_DOOR:
+ state_ = STATE_CLOSE_DOOR;
+ transition_close_door ();
+ break;
+ default:
+ bad_transition (state_, e);
+ break;
+ } // end switch (e)
+ break;
+
+ case STATE_OPEN_DOOR:
+ switch (e)
+ {
+ case EVT_WAIT:
+ state_ = STATE_WAIT;
+ transition_begin_wait ();
+ break;
+ default:
+ bad_transition (state_, e);
+ break;
+ } // end switch (e)
+ break;
+
+ case STATE_CLOSE_DOOR:
+ switch (e)
+ {
+ case EVT_OPEN_DOOR:
+ state_ = STATE_OPEN_DOOR;
+ transition_open_door ();
+ break;
+ case EVT_UP:
+ state_ = STATE_UP;
+ transition_move_up ();
+ break;
+ case EVT_DOWN:
+ state_ = STATE_DOWN;
+ transition_move_down ();
+ break;
+ case EVT_IDLE:
+ state_ = STATE_IDLE;
+ transition_move_idle ();
+ break;
+ default:
+ bad_transition (state_, e);
+ break;
+ } // end switch (e)
+ break;
+
+ default:
+ std::cout << "Bad State: " << get_state_name (state_) << std::endl;
+ break;
+ }
+}
+
+bool Elevator::is_idle () const
+{
+ if (stops_.size() != 0)
+ return false;
+
+ return direction_ == IDLE;
+}