01: package fit.decorator;
02:
03: import fit.Fixture;
04: import fit.Parse;
05: import fit.decorator.exceptions.InvalidInputException;
06: import fit.decorator.util.Delta;
07: import fit.decorator.util.Table;
08:
09: public class IncrementColumnsValue extends FixtureDecorator {
10:
11: public static final String COLUMN_NAME = "columnName";
12: public static final String DELTA = "delta";
13: private String columnName;
14: private Delta delta;
15:
16: protected void setupDecorator(String[] arguments)
17: throws InvalidInputException {
18: if (arguments.length != 3) {
19: throw new InvalidInputException(
20: "Column name, Data type and Delta Value must be specified");
21: }
22: columnName = arguments[0];
23: delta = new Delta(arguments[1], arguments[2]);
24: summary.put(COLUMN_NAME, columnName);
25: summary.put(DELTA, delta);
26: }
27:
28: protected void run(Fixture fixture, Parse table) {
29: Table t = new Table(table);
30: try {
31: table = t.incrementColumnValuesByDelta(columnName, delta);
32: } catch (InvalidInputException e) {
33: // exception(table, e);
34: }
35: super .run(fixture, table);
36: }
37:
38: protected void updateColumnsBasedOnResults(Parse table) {
39: // nothing to do
40: }
41: }
|