Example #1
0
  @Override
  public void drawTree(View v) {

    if (this.state != INVISIBLE) {

      /*
       * if (thread) { v.setColor(Color.red); } else {
       */
      v.setColor(Color.black);
      // }

      if ((getLeft() != null) && (getLeft().state != INVISIBLE)) {
        if (dashedLeftLine) {
          v.drawDashedLine(x, y, getLeft().x, getLeft().y);
        } else {
          v.drawLine(x, y, getLeft().x, getLeft().y);
        }
      }
      if ((getRight() != null) && (getRight().state != INVISIBLE)) {
        if (dashedRightLine) {
          v.drawDashedLine(x, y, getRight().x, getRight().y);
        } else {
          v.drawLine(x, y, getRight().x, getRight().y);
        }
      }
    }
    if (getLeft() != null) {
      getLeft().drawTree(v);
    }
    if (getRight() != null) {
      getRight().drawTree(v);
    }
    draw(v);
  }
Example #2
0
 @Override
 public void draw(View v) {
   super.draw(v);
   drawDoubleArrow(v);
   final String str = "" + rank;
   if (rank != -1) {
     if (this.getParent() != null && this.getParent().getLeft() == this) {
       v.drawString(str, x - Node.RADIUS, y - Node.RADIUS, Fonts.SMALL);
     } else {
       v.drawString(str, x + Node.RADIUS, y - Node.RADIUS, Fonts.SMALL);
     }
   }
 }
Example #3
0
 @Override
 protected void draw(View v) throws ConcurrentModificationException {
   if (u.x != x || u.y != y) {
     recompute();
   }
   v.fillPolygon(p);
 }
Example #4
0
 @Override
 public void draw(View V) {
   if (str != null) {
     str.draw(V);
   }
   final SuffixTreeNode v = getRoot();
   if (v != null) {
     v.drawTree(V);
     V.drawString("\u025B", v.x, v.y - 8, Fonts.NORMAL);
   }
 }
Example #5
0
 @Override
 protected void draw(View V) {
   BSTNode z;
   if (u != null) {
     z = u.getParent();
     if (z == v || z == w) {
       V.drawWideLine(u.x, u.y, z.x, z.y);
     }
   }
   if (v != null) {
     z = v.getParent();
     if (z == u || z == w) {
       V.drawWideLine(v.x, v.y, z.x, z.y);
     }
   }
   if (w != null) {
     z = w.getParent();
     if (z == u || z == v) {
       V.drawWideLine(w.x, w.y, z.x, z.y);
     }
   }
 }
Example #6
0
 private void drawDoubleArrow(View v) {
   if (!doubleArrow || dir == null) {
     return;
   }
   int x1, y1, x2, y2;
   if (x < dir.x) {
     x1 = x;
     y1 = y;
     x2 = dir.x;
     y2 = dir.y;
   } else {
     x2 = x;
     y2 = y;
     x1 = dir.x;
     y1 = dir.y;
   }
   v.drawDoubleArrow(x1 + 2 * Node.RADIUS, y1, x2 - 2 * Node.RADIUS, y2);
 }