// --------------------------------------- // Restricted Focus Viewer (RFV) Program // Version 2.1 // Language: Java 2 // October, 2000 // Copyright (C) 2000 Anthony R. Jansen // --------------------------------------- // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------- // RFV_Motion_Blur_Thread.java // // This class is a thread that stops the // motion blur from continuing if the // mouse has stopped moving for longer // than a specified time threshold. // --------------------------------------- public class RFV_Motion_Blur_Thread extends Thread { // Need RFV so that stimulus can be updated // ---------------------------------------- private RFV rfv; private boolean valid; // Define threshold // ---------------- private static final long MOTION_BLUR_THRESHOLD = 50; private static final long QUICK_SLEEP_TIME = 10; // Constructor which accepts the RFV as an argument // ------------------------------------------------ public RFV_Motion_Blur_Thread(RFV r) { rfv = r; valid = true; } // Interrupt thread if it is no longer needed // ------------------------------------------ public void interrupt() { valid = false; } // Thread to deactivate motion blur if mouse stops suddenly // -------------------------------------------------------- public void run() { while (rfv.getElapsedMotionBlurTime() < MOTION_BLUR_THRESHOLD) { try { this.sleep(QUICK_SLEEP_TIME); } catch(InterruptedException e) { ; } } // End the thread and redraw the stimulus // -------------------------------------- if (valid) rfv.endMotionBlur(); } }