Commit 618ff639 authored by Riegel's avatar Riegel
Browse files

Converted for each loop to explicit implementation. Ref #69

parent 5ebd7188
......@@ -52,22 +52,20 @@ public class ArgumentParser {
HashMap<String, List<String>> params = new HashMap<>();
List<String> options = null;
for (int i = 0; i < args.length; i++) {
final String a = args[i];
if (a.charAt(0) == '-') {
if (a.length() < 2) {
ErrorHandler.printHelpAndTerminate("Error while parsing argument " + a);
}
String flag = a.substring(1).toLowerCase();
options = new ArrayList<>();
params.put(flag, options);
} else if (options != null) {
options.add(a);
} else {
ErrorHandler.printHelpAndTerminate("Illegal parameter usage at " + a);
}
}
for (final String a : args) {
if (a.charAt(0) == '-') {
if (a.length() < 2) {
ErrorHandler.printHelpAndTerminate("Error while parsing argument " + a);
}
String flag = a.substring(1).toLowerCase();
options = new ArrayList<>();
params.put(flag, options);
} else if (options != null) {
options.add(a);
} else {
ErrorHandler.printHelpAndTerminate("Illegal parameter usage at " + a);
}
}
return params;
}
......
......@@ -30,13 +30,13 @@ public class Table {
private static final String TABLE_HEADER_COLOR = "#58ACFA";
private Element tableBlock;
private final Element tableBlock;
private Element tableHeader;
private Element tableBody;
private Element tableElement;
private final Element tableHeader;
private final Element tableBody;
private final Element tableElement;
private int columns;
private final int columns;
public Table(int columns) {
this.columns = columns;
......@@ -101,13 +101,13 @@ public class Table {
private Element createTableRow(String... content) {
Element tableRow = new Element("table-row", PdfReport.FO_NS);
for (int i = 0; i < content.length; i++) {
Element tableCell = new Element("table-cell", PdfReport.FO_NS);
tableRow.addContent(tableCell);
tableCell.addContent(PdfReport.createTextElement(content[i]));
tableCell.setAttribute("padding", "3pt 3pt 3pt 3pt");
PdfReport.applySolidBorder(tableCell);
}
for (String s : content) {
Element tableCell = new Element("table-cell", PdfReport.FO_NS);
tableRow.addContent(tableCell);
tableCell.addContent(PdfReport.createTextElement(s));
tableCell.setAttribute("padding", "3pt 3pt 3pt 3pt");
PdfReport.applySolidBorder(tableCell);
}
return tableRow;
}
......
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