示例#1
0
 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;
 }
示例#2
0
 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;
 }
示例#3
0
 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;
 }
示例#4
0
  private int join(DrawingTree dt) {
    int w, sum;

    dt.contour = dt.children[0].contour;
    sum = w = dt.children[0].width + 2 * BORDER;

    for (int i = 1; i < dt.children.length; i++) {
      int d = merge(dt.contour, dt.children[i].contour);
      dt.children[i].offset.x = d + w;
      dt.children[i].offset.y = 0;
      w = dt.children[i].width + 2 * BORDER;
      sum += d + w;
    }
    return sum;
  }