// @topic S-0303-03-02-06 Java MVC Architecture Demo 3 // @brief class ThreadAnimation (a worker thread to animate elevator movements) package radio_button_test; public class ThreadAnimation implements Runnable { //------------------------------ // data //------------------------------ private static final long ANIMATION_TIMEOUT_MS = 300; // half second private ControllerDemo controller; //------------------------------ // constructors //------------------------------ public ThreadAnimation( ControllerDemo controller ) { this.controller = controller; }//ThreadAnimation //------------------------------ // operations //------------------------------ @Override public void run() { for ( int count = 0; count < 999; ++count ) { try { Thread.sleep( ANIMATION_TIMEOUT_MS ); } catch ( InterruptedException ex ) { System.out.println("InterruptedException"); return; } //System.out.println("Controller animate" + controller); controller.animate(); } }//run }//class ThreadAnimation