Todo.java

Go to the documentation of this file.
00001 import java.util.*; 00002 00003 public abstract class Todo extends TimerTask { 00004 //private static LinkedList manager = new LinkedList(); 00005 private static Timer timer = null; 00006 00007 Object arg1 = null; 00008 Object arg2 = null; 00009 00010 public final synchronized static void reset() { 00011 if (timer!=null) timer.cancel(); 00012 timer = null; 00013 } 00014 00015 /*public final static void doActions() { 00016 while (!manager.isEmpty()) { 00017 try { 00018 Todo todo = (Todo)manager.removeFirst(); 00019 System.out.println("Action: "+todo.toString()); 00020 todo.action(); 00021 } catch (Throwable e) { 00022 System.out.println("In Todo manager:"); 00023 e.printStackTrace(); 00024 } 00025 } 00026 }*/ 00027 00028 public void run() { 00029 try { 00030 //Todo todo = (Todo)manager.removeFirst(); 00031 System.out.println("Action: "+toString()); 00032 action(); 00033 } catch (Throwable e) { 00034 System.out.println("In Todo manager:"); 00035 e.printStackTrace(); 00036 } 00037 } 00038 public abstract void action() throws Throwable; 00039 private void init() { 00040 System.out.println("Queued: "+toString()); 00041 //manager.add(this); 00042 if (timer==null) timer = new Timer(); 00043 timer.schedule(this,1); 00044 }; 00045 public Todo() { init(); }; 00046 public Todo(Object a1) { arg1 = a1; init(); }; 00047 public Todo(Object a1, Object a2) { 00048 arg1 = a1; arg2 = a2; init(); }; 00049 }

Generated on Sun Aug 15 11:56:54 2004 for International Input by doxygen 1.3.7