KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > incava > util > TimedEvent


1 package org.incava.util;
2
3
4
5 /**
6  * Times an event, from when the object is created, until when the
7  * <code>end</code> method is invoked.
8  */

9 public class TimedEvent
10 {
11     public long duration;
12
13     private long startTime;
14
15     private TimedEventSet set;
16
17     public TimedEvent(TimedEventSet set)
18     {
19         this.set = set;
20         this.startTime = System.currentTimeMillis();
21     }
22
23     public void end()
24     {
25         tr.Ace.log("ending");
26         duration = System.currentTimeMillis() - startTime;
27         set.add(duration);
28         tr.Ace.log("ended");
29     }
30 }
31
Popular Tags