private void writeElement(PhraseStructureNode element, int depth) throws MaltChainedException {
try {
if (element instanceof TokenNode) {
PhraseStructureNode t = (PhraseStructureNode)element;
SymbolTable table = null;
writer.write("\n" + getIndentation(depth) + STARTING_BRACKET);
int i = 0;
for (String inputColumn : inputColumns.keySet()) {
if (i != 0) {
writer.write(INPUT_SEPARATOR);
}
table = inputColumns.get(inputColumn).getSymbolTable();
if (t.hasLabel(table)) {
writer.write(encodeString(t.getLabelSymbol(table)));
}
if (i == 0) {
for (String edgeLabelColumn : edgeLabelColumns.keySet()) {
table = edgeLabelColumns.get(edgeLabelColumn).getSymbolTable();
if (t.hasParentEdgeLabel(table) && !t.getParent().isRoot() && !t.getParentEdgeLabelSymbol(table).equals(EMPTY_EDGELABEL)) {
writer.write(EDGELABEL_SEPARATOR);
writer.write(t.getParentEdgeLabelSymbol(table));
}
}
}
i++;
}
writer.write(CLOSING_BRACKET);
} else {
NonTerminalNode nt = (NonTerminalNode)element;
writer.write("\n" + getIndentation(depth) + STARTING_BRACKET);
SymbolTable table = null;
int i = 0;
for (String phraseLabelColumn : phraseLabelColumns.keySet()) {
if (i != 0) {
writer.write(INPUT_SEPARATOR);
}