Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Exporter
Browse files Browse the repository at this point in the history
ThisMatt committed Oct 3, 2023
1 parent b6c9daf commit bae1a1f
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -15,8 +15,7 @@ protected org.w3c.dom.Element createBoardElement(Document newDocument) {
SkyscrapersBoard board = (SkyscrapersBoard) puzzle.getTree().getRootNode().getBoard();

org.w3c.dom.Element boardElement = newDocument.createElement("board");
boardElement.setAttribute("width", String.valueOf(board.getWidth()));
boardElement.setAttribute("height", String.valueOf(board.getHeight()));
boardElement.setAttribute("size", String.valueOf(board.getWidth()));

org.w3c.dom.Element cellsElement = newDocument.createElement("cells");
for (PuzzleElement puzzleElement : board.getPuzzleElements()) {
@@ -30,20 +29,20 @@ protected org.w3c.dom.Element createBoardElement(Document newDocument) {

org.w3c.dom.Element axisEast = newDocument.createElement("axis");
axisEast.setAttribute("side", "east");
for (SkyscrapersClue clue : board.getEastClues()) {
for (int i=0; i<board.getWidth(); i++) {
org.w3c.dom.Element clueElement = newDocument.createElement("clue");
clueElement.setAttribute("value", String.valueOf(clue.getData()));
clueElement.setAttribute("index", SkyscrapersClue.colNumToString(clue.getIndex()));
clueElement.setAttribute("value", String.valueOf(board.getEastClues().get(i).getData()));
clueElement.setAttribute("index", String.valueOf(board.getWestClues().get(i).getData()));
axisEast.appendChild(clueElement);
}
boardElement.appendChild(axisEast);

org.w3c.dom.Element axisSouth = newDocument.createElement("axis");
axisSouth.setAttribute("side", "south");
for (SkyscrapersClue clue : board.getSouthClues()) {
for (int i=0; i<board.getWidth(); i++) {
org.w3c.dom.Element clueElement = newDocument.createElement("clue");
clueElement.setAttribute("value", String.valueOf(clue.getData()));
clueElement.setAttribute("index", String.valueOf(clue.getIndex()));
clueElement.setAttribute("value", String.valueOf(board.getSouthClues().get(i).getData()));
clueElement.setAttribute("index", String.valueOf(board.getNorthClues().get(i).getData()));
axisSouth.appendChild(clueElement);
}
boardElement.appendChild(axisSouth);

0 comments on commit bae1a1f

Please sign in to comment.