private DrawingTree layoutBinary(String name, ASTNode child1, ASTNode child2) { DrawingTree dt = layoutCaption(name); DrawingTree d1 = (DrawingTree) child1.accept(this); DrawingTree d2 = (DrawingTree) child2.accept(this); dt.setChildren(new DrawingTree[] {d1, d2}); attachParent(dt, join(dt)); return dt; }
private DrawingTree layoutQuintenary( String name, ASTNode child1, ASTNode child2, ASTNode child3, ASTNode child4, ASTNode child5) { 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); DrawingTree d5 = (DrawingTree) child5.accept(this); dt.setChildren(new DrawingTree[] {d1, d2, d3, d4, d5}); 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; }