Limiting iteration for now (DFSearch strategy would just go deep unceasingly); Comple...
[smartthings-infrastructure.git] / Timer / SimulatedTimer.groovy
1 //Create a class for timer\r
2 package Timer\r
3 \r
4 public class SimulatedTimer {\r
5         private Thread thread;\r
6 \r
7         SimulatedTimer() {\r
8                 thread = null;\r
9         }\r
10 \r
11         //By Apps\r
12         def runAfter(int delay, Closure closure) {\r
13                 /*thread = new Thread() {\r
14         \r
15                         @Override\r
16                         public void run() {\r
17                                 Thread.sleep(delay)\r
18                                 closure()\r
19                         }\r
20                 }.start()\r
21                 return thread*/\r
22                 closure()\r
23         }\r
24 \r
25         def cancel() {\r
26                 //if (thread != null)\r
27                 //      thread.stop()\r
28         }\r
29 }\r