use of output.HTMLColumn in project solution-finder by knewjade.
the class LinkPathOutput method outputOperationsToSimpleHTML.
private void outputOperationsToSimpleHTML(Field field, MyFile file, List<PathPair> pathPairs, SizedBit sizedBit) throws FinderExecuteException {
// Get height
int maxClearLine = sizedBit.getHeight();
// テト譜用のフィールド作成
ColoredField initField = ColoredFieldFactory.createField(24);
for (int y = 0; y < maxClearLine; y++) for (int x = 0; x < 10; x++) if (!field.isEmpty(x, y))
initField.setColorType(ColorType.Gray, x, y);
// 並び替える
Comparator<PathPair> comparator = new PathPairComparator();
pathPairs.sort(comparator);
// HTMLの生成 // true: ライン消去あり, false: ライン消去なし
HTMLBuilder<HTMLColumn> htmlBuilder = new HTMLBuilder<>("Path Result");
htmlBuilder.addHeader(String.format("<div>%dパターン</div>", pathPairs.size()));
pathPairs.parallelStream().forEach(pathPair -> {
PathHTMLColumn htmlColumn = getHTMLColumn(pathPair);
Pair<String, Integer> linkAndPriority = createALink(pathPair);
String line = String.format("<div>%s</div>", linkAndPriority.getKey());
htmlBuilder.addColumn(htmlColumn, line, -linkAndPriority.getValue());
});
// 出力
try (BufferedWriter writer = file.newBufferedWriter()) {
List<HTMLColumn> priorityList = Arrays.asList(PathHTMLColumn.NotDeletedLine, PathHTMLColumn.DeletedLine);
for (String line : htmlBuilder.toList(priorityList, false)) writer.write(line);
writer.flush();
} catch (Exception e) {
throw new FinderExecuteException("Failed to output file", e);
}
}
Aggregations