01: package fit.decorator;
02:
03: import fit.Fixture;
04: import fit.Parse;
05: import fit.decorator.exceptions.InvalidInputException;
06: import fit.decorator.util.Table;
07:
08: public class CopyAndAppendLastRow extends FixtureDecorator {
09: public static final String NUMBER_OF_TIMES = "numberOfTimes";
10: private int numberOfTimes;
11:
12: protected void run(Fixture fixture, Parse table) {
13: Table t = new Table(table);
14: t.copyAndAppendLastRow(numberOfTimes);
15: super .run(fixture, t.table());
16: }
17:
18: protected void setupDecorator(String[] arguments)
19: throws InvalidInputException {
20: if (arguments.length != 1) {
21: throw new InvalidInputException(
22: "Count for number of times to add the last row must be specified");
23: }
24: numberOfTimes = Integer.parseInt(arguments[0]);
25: summary.put(NUMBER_OF_TIMES, new Integer(numberOfTimes));
26: }
27:
28: protected void updateColumnsBasedOnResults(Parse table) {
29: // Nothing to do
30: }
31: }
|