1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package pl.edu.agh.cast.rawdata.stat;
19
20 import java.util.LinkedList;
21 import java.util.List;
22
23 import pl.edu.agh.cast.rawdata.DataRow;
24
25
26
27
28
29
30 public class BrokenRowInfo {
31
32 private List<BrokenCellInfo> brokenCells;
33
34 private DataRow sourceRow;
35
36 private boolean canBeConverted;
37
38
39
40
41
42
43
44 public BrokenRowInfo(DataRow sourceRow) {
45 this.sourceRow = sourceRow;
46 this.canBeConverted = true;
47 this.brokenCells = new LinkedList<BrokenCellInfo>();
48
49 }
50
51
52
53
54
55
56
57
58
59
60
61 public void addBrokenCellInfo(int columnIndex, ErrorInfo error) {
62 BrokenCellInfo brokenCellInfo = new BrokenCellInfo(this, columnIndex, error);
63 brokenCells.add(brokenCellInfo);
64 if (error.getSeverity() == ErrorSeverity.ERROR) {
65 canBeConverted = false;
66 }
67
68 }
69
70
71
72
73
74
75 public boolean canBeConverted() {
76 return canBeConverted;
77 }
78
79
80
81
82
83
84 public boolean isRowError() {
85 for (BrokenCellInfo cellInfo : brokenCells) {
86 if (cellInfo.getColumn() == BrokenCellInfo.WHOLE_ROW_BROKEN) {
87 return true;
88 }
89 }
90 return false;
91 }
92
93 public List<BrokenCellInfo> getBrokenCells() {
94 return brokenCells;
95 }
96
97 public DataRow getSourceRow() {
98 return sourceRow;
99 }
100
101
102
103
104
105
106
107 @Override
108 public String toString() {
109 StringBuffer res = new StringBuffer();
110 res.append("Data row: ").append(getSourceRow().toString()).append(
111 ", broken cells: ").append(getBrokenCells().toString()).append(
112 "]");
113 return res.toString();
114 }
115 }