// @topic S-0303-03-01-40 Java MVC Architecture Demo 2 // @brief class ThreadAnimation (a worker thread to animate elevator movements) package demo; public class ThreadAnimation implements Runnable { //------------------------------ // data //------------------------------ private static final long ANIMATION_TIMEOUT_MS = 500; // half second private ControllerDemo controller; //------------------------------ // constructors //------------------------------ public ThreadAnimation( ControllerDemo controller ) { this.controller = controller; }//ThreadAnimation //------------------------------ // operations //------------------------------ @Override public void run() { for ( int count = 0; count < 24; ++count ) { try { Thread.sleep( ANIMATION_TIMEOUT_MS ); } catch ( InterruptedException ex ) { return; } controller.animate(); } }//run }//class ThreadAnimation