// // Clock class // // // This is just a clock that increments in intervals of 0.3 seconds. // It is needed to timestamp process creations and deletions. // import java.lang.Thread; class Clock extends Thread implements Runnable { static float clockTime = (float) 0.0; private boolean keep_running = true; static gui_aux GUI; // Accesor method to GUI public static void setGUI(gui_aux obj) { GUI = obj; } // Accesor method to read the clockTime variable public static float getTime() { return clockTime; } // Accesor method to modify the clockTime variable public static void setTime(float time) { clockTime = time; } public void pause() { keep_running = !keep_running; } public void turnoff() { keep_running = false; } public void run() { while(true) if(keep_running){ try { clockTime += 1.0; GUI.repaint((long)10); Thread.sleep(1000); } catch (InterruptedException e) {} } else try { Thread.sleep(1000); } catch (InterruptedException e) {} } }