01: package fit.decorator.performance;
02:
03: import fit.Fixture;
04: import fit.Parse;
05: import fit.decorator.exceptions.InvalidInputException;
06: import fit.decorator.util.Timer;
07:
08: public class TimeRange extends TimeBasedFixtureDecorator {
09: public static final String MIN_TIME = "minTime";
10: public static final String MAX_TIME = "maxTime";
11: protected long maxTime;
12: private long minTime;
13:
14: public TimeRange() {
15: super ();
16: }
17:
18: TimeRange(Timer stopWatch) {
19: super (stopWatch);
20: }
21:
22: protected void run(Fixture fixture, Parse table) {
23: super .run(fixture, table);
24: summary.put(ACTUAL_TIME_TAKEN, new Long(elapsedTime));
25: }
26:
27: protected void setupDecorator(String[] arguments)
28: throws InvalidInputException {
29: if (arguments.length != 2) {
30: throw new InvalidInputException(
31: "Time range must be specified");
32: }
33: minTime = Long.parseLong(arguments[0]);
34: summary.put(MIN_TIME, new Long(minTime));
35: maxTime = Long.parseLong(arguments[1]);
36: summary.put(MAX_TIME, new Long(maxTime));
37: }
38:
39: protected void updateColumnsBasedOnResults(Parse table) {
40: updateColumns(table.parts.parts.more, elapsedTime, minTime,
41: false);
42: updateColumns(table.parts.parts.more.more.more, elapsedTime,
43: maxTime, true);
44: }
45: }
|