Commit 5a4d0a74 authored by Riegel's avatar Riegel
Browse files

Extracted method. Ref #69

parent 59e8a24d
Pipeline #10055 passed with stage
in 1 minute and 11 seconds
...@@ -393,21 +393,7 @@ public class PdfStreamReporter implements StreamReporter { ...@@ -393,21 +393,7 @@ public class PdfStreamReporter implements StreamReporter {
@Override @Override
public void finishReport() throws CheckReportWriteException { public void finishReport() throws CheckReportWriteException {
if (buildings != null) { if (buildings != null) {
for (Section s : buildings.getSubSections()) { countFinishedReportBuildings();
if (!s.hasErrors()) {
numOkBuildings++;
// building has no errors, no table
continue;
}
numErrorBuildings++;
Table t = new Table(2);
t.setTableColumnWidth(75, 25);
t.setTitle("Error", "Count");
for (Entry<String, AtomicInteger> e : s.getStats().getErrorCounts().entrySet()) {
t.addRow(e.getKey(), e.getValue().toString());
}
s.addTable(1, t);
}
} }
int numBuildings = numErrorBuildings + numOkBuildings; int numBuildings = numErrorBuildings + numOkBuildings;
if (numBuildings > 0) { if (numBuildings > 0) {
...@@ -446,6 +432,24 @@ public class PdfStreamReporter implements StreamReporter { ...@@ -446,6 +432,24 @@ public class PdfStreamReporter implements StreamReporter {
report.save(outFile); report.save(outFile);
} }
private void countFinishedReportBuildings() {
for (Section s : buildings.getSubSections()) {
if (!s.hasErrors()) {
numOkBuildings++;
// building has no errors, no table
continue;
}
numErrorBuildings++;
Table t = new Table(2);
t.setTableColumnWidth(75, 25);
t.setTitle("Error", "Count");
for (Entry<String, AtomicInteger> e : s.getStats().getErrorCounts().entrySet()) {
t.addRow(e.getKey(), e.getValue().toString());
}
s.addTable(1, t);
}
}
@Override @Override
public void reportGlobalError(CheckError err) { public void reportGlobalError(CheckError err) {
AtomicInteger errorCount = errorStatistics.computeIfAbsent(err.getErrorId(), k -> new AtomicInteger(0)); AtomicInteger errorCount = errorStatistics.computeIfAbsent(err.getErrorId(), k -> new AtomicInteger(0));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment