private NodeSetGraphic drawChild(int level, int counter, int numTest, PMLNode aNode) {
    NodeSetGraphic aChild;
    int y = (level - 1) * yInc;
    if (counter == 0) {
      int cur_childX = _levels[level - 1];
      int cur_parX = _levels[level];

      if (cur_childX < cur_parX) {
        if (numTest == 1) {
          int perfectX = cur_parX + xInc;
          _levels[level - 1] = perfectX;
          aChild = _canvasManager.drawNode(perfectX, y, aNode);
        } else {
          int perfectX = cur_parX;
          _levels[level - 1] = perfectX;
          aChild = _canvasManager.drawNode(perfectX, y, aNode);
        }
      } else {
        int occupiedXforChild = _levels[level - 1];
        _levels[level - 1] = occupiedXforChild + xInc;
        int x = occupiedXforChild + xInc;
        aChild = _canvasManager.drawNode(x, y, aNode);
      }
    } else {
      int occupiedXforChild = _levels[level - 1];
      _levels[level - 1] = occupiedXforChild + xInc;
      int x = occupiedXforChild + xInc;

      aChild = _canvasManager.drawNode(x, y, aNode);
    }
    return aChild;
  }
  private NodeSetGraphic drawParent(PMLNode node, int level, ArrayList childNodes) {
    NodeSetGraphic firstChild = (NodeSetGraphic) childNodes.get(0);
    NodeSetGraphic lastChild = (NodeSetGraphic) childNodes.get(childNodes.size() - 1);

    int finalX = 0;
    int lastChildX = _levels[level - 1];
    int lastParentX = _levels[level];

    if (childNodes.size() > 1) {
      int childrenWidth = lastChild.getX() - firstChild.getX();
      int mid = childrenWidth / 2;
      int perfectX = _levels[level - 1] - mid;

      if (perfectX > lastParentX + xInc) {
        finalX = perfectX;
      } else {
        finalX = lastParentX + xInc;
      }
      _levels[level] = finalX;
    } else {
      if (lastChildX > lastParentX + xInc) {
        finalX = lastChildX;
      } else {
        finalX = lastParentX + xInc;
      }
      _levels[level] = finalX;
    }

    if (finalX == 0) System.out.println("LAGGGG");

    int parentY = (level) * yInc;
    NodeSetGraphic parent = _canvasManager.drawNode(finalX, parentY, node);

    for (int i = 0; i < childNodes.size(); i++) {
      _canvasManager.makeEdge(parent, (NodeSetGraphic) childNodes.get(i));
    }
    return parent;
  }
 private NodeSetGraphic drawOnlyChild(PMLNode node) {
   return _canvasManager.drawNode(50, 50, node);
 }
 public JCanvas draw() {
   setUpLevels();
   _rootGraphic = drawDAG(_rootNode, 1000, maxHeight - 1);
   return _canvasManager.getCurrentDAG();
 }