if (size == 0) {
return true;
}
// BLOCK is the last child
Node block = node.jjtGetChild(node.jjtGetNumChildren() - 1);
String join = (size > 1) ? (String) node.jjtGetChild(0).value(context) : "";
String prefix = (size > 2) ? (String) node.jjtGetChild(1).value(context) : "";
// if there is a conditional prefix, use a separate buffer ofr children
StringWriter childWriter = new StringWriter(30);
int len = block.jjtGetNumChildren();
int includedChunks = 0;
for (int i = 0; i < len; i++) {
Node child = block.jjtGetChild(i);
// if this is a "chunk", evaluate its expression and prepend join if included...
if (child instanceof ASTDirective
&& "chunk".equals(((ASTDirective) child).getDirectiveName())) {
if (child.jjtGetNumChildren() < 2
|| child.jjtGetChild(0).evaluate(context)) {
if (includedChunks > 0) {
childWriter.write(join);
}
includedChunks++;
}
}
child.render(context, childWriter);
}
if (includedChunks > 0) {
childWriter.flush();
writer.write(prefix);