private DrawingTree layoutUnary(String name, ASTNode child1) { DrawingTree dt = layoutCaption(name); DrawingTree d1 = (DrawingTree) child1.accept(this); dt.setChildren(new DrawingTree[] {d1}); attachParent(dt, join(dt)); return dt; }
private DrawingTree layoutQuaternary( String name, ASTNode child1, ASTNode child2, ASTNode child3, ASTNode child4) { DrawingTree dt = layoutCaption(name); DrawingTree d1 = (DrawingTree) child1.accept(this); DrawingTree d2 = (DrawingTree) child2.accept(this); DrawingTree d3 = (DrawingTree) child3.accept(this); DrawingTree d4 = (DrawingTree) child4.accept(this); dt.setChildren(new DrawingTree[] {d1, d2, d3, d4}); attachParent(dt, join(dt)); return dt; }
private DrawingTree layoutNary(String name, ListNode childNodes) { if (childNodes.getSize() == 0) return layoutNullary("Empty" + name); DrawingTree dt = layoutCaption(name); DrawingTree[] childTrees = new DrawingTree[childNodes.getSize()]; int i = 0; for (ASTNode childNode : childNodes) { childTrees[i] = (DrawingTree) childNode.accept(this); i++; } dt.setChildren(childTrees); attachParent(dt, join(dt)); return dt; }