1 package guru.mikelue.jdut.operation;
2
3 import java.sql.Connection;
4 import java.sql.SQLException;
5 import java.util.List;
6 import java.util.function.UnaryOperator;
7
8 import guru.mikelue.jdut.datagrain.DataGrain;
9 import guru.mikelue.jdut.datagrain.DataRow;
10
11
12
13
14 @FunctionalInterface
15 public interface DataRowsOperator {
16
17
18
19 public interface SurroundOperator {
20
21
22
23
24
25 default UnaryOperator<DataRowsOperator> asUnaryOperator()
26 {
27 return operator -> surround(operator);
28 }
29
30
31
32
33
34
35
36
37 public DataRowsOperator../guru/mikelue/jdut/operation/DataRowsOperator.html#DataRowsOperator">DataRowsOperator surround(DataRowsOperator surroundedOperator);
38 }
39
40
41
42
43
44
45
46
47
48 static List<DataRow> none(Connection conn, List<DataRow> dataRows) { return dataRows; }
49
50
51
52
53
54
55 default DataGrainOperator toDataGrainOperator()
56 {
57 return (connection, dataGrain) -> new DataGrain(operate(connection, dataGrain.getRows()));
58 }
59
60
61
62
63
64
65
66
67 default DataRowsOperator surroundedBy(SurroundOperator surroundOperator)
68 {
69 return surroundOperator.surround(this);
70 }
71
72
73
74
75
76
77
78
79
80
81
82 public List<DataRow> operate(Connection connection, List<DataRow> dataRows) throws SQLException;
83 }