1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.tuigwaa.database;
17
18 import com.isenshi.util.functor.BinaryFunction;
19
20 public class ExtraRowDataTable extends DataTableWrapper {
21
22 private BinaryFunction function;
23
24 public ExtraRowDataTable(DataTable dataTable, BinaryFunction function) {
25 super(dataTable);
26 this.function = function;
27 }
28
29 public int getRowSize() {
30 return super.getRowSize() + 1;
31 }
32
33 public Object getData() {
34 return getData(getCurrentColumn(), getCurrentRow());
35 }
36
37 public Object getData(int row, int column) {
38 if(super.hasNextRow()){
39 return super.getData(row, column);
40 }else{
41 initCurrentRow();
42 next();
43 Object obj = super.getData(column);
44 while(hasNext()){
45 next();
46 if(lastRow()){
47 break;
48 }
49 obj = function.evaluate(obj, super.getData(column));
50 }
51 return obj;
52 }
53 }
54 }