01: package fit.decorator;
02:
03: import fit.Fixture;
04: import fit.Parse;
05: import fit.decorator.exceptions.InvalidInputException;
06:
07: public class Loop extends FixtureDecorator {
08: public static final String COUNT = "count";
09: private int counter;
10:
11: protected void run(Fixture fixture, Parse table) {
12: for (int i = 0; i < counter; i++) {
13: super .run(fixture, table);
14: }
15: }
16:
17: protected void setupDecorator(String[] arguments)
18: throws InvalidInputException {
19: if (arguments.length != 1) {
20: throw new InvalidInputException(
21: "Loop count must be specified");
22: }
23: counter = Integer.parseInt(arguments[0]);
24: summary.put(COUNT, new Long(counter));
25: }
26:
27: protected void updateColumnsBasedOnResults(Parse table) {
28: // Nothing to do
29: }
30: }
|