01: // Copyright (c) 2002 Cunningham & Cunningham, Inc.
02: // Released under the terms of the GNU General Public License version 2 or later.
03:
04: package fit;
05:
06: import java.util.Date;
07: import java.text.*;
08:
09: public class TimedActionFixture extends ActionFixture {
10:
11: public DateFormat format = new SimpleDateFormat("hh:mm:ss");
12:
13: // Traversal ////////////////////////////////
14:
15: public void doTable(Parse table) {
16: super .doTable(table);
17: table.parts.parts.last().more = td("time");
18: table.parts.parts.last().more = td("split");
19: }
20:
21: public void doCells(Parse cells) {
22: Date start = time();
23: super .doCells(cells);
24: long split = time().getTime() - start.getTime();
25: cells.last().more = td(format.format(start));
26: cells.last().more = td(split < 1000 ? " " : Double
27: .toString((split) / 1000.0));
28: }
29:
30: // Utility //////////////////////////////////
31:
32: public Date time() {
33: return new Date();
34: }
35:
36: public Parse td(String body) {
37: return new Parse("td", info(body), null, null);
38: }
39:
40: }
|