pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

epitaph64 private pastebin - collaborative debugging tool What's a private pastebin?


Posted by Epitaph64 on Sun 31 May 02:27
report abuse | download | new post

  1. private void genOne()
  2.     {
  3.         tree = new ArrayList<TreeNode>();
  4.         tree.clear();
  5.         new TreeNode(400, 500, 0, 100);
  6.     }
  7.  
  8.     class TreeNode
  9.     {
  10.         TreeNode left;
  11.         TreeNode right;
  12.         int cX;
  13.         int cY;
  14.         int level;
  15.         int size;
  16.        
  17.         TreeNode(int x, int y, int level, int maxSize)
  18.         {
  19.             tree.add(this);
  20.             this.cX = x;
  21.             this.cY = y;
  22.             this.level = level;
  23.             this.size = maxSize;
  24.             if (level < maxSize)
  25.             {
  26.                 if (mt.nextBoolean() || level < (2))
  27.                 left = new TreeNode(cX - mt.nextInt(10), cY - mt.nextInt(5) - 2, level + 1, size);
  28.                 if (mt.nextBoolean() || level < (2))
  29.                 right = new TreeNode(cX + mt.nextInt(10), cY - mt.nextInt(5) - 2, level + 1, size);
  30.             }
  31.         }
  32.  
  33.         void draw(Graphics g)
  34.         {
  35.             g.setColor(new Color(75 + (this.level * 5), 255, 75 + (this.level * 5)));
  36.             if (left != null)
  37.             {
  38.                 g.drawLine(cX, cY, left.cX, left.cY);
  39.             }
  40.             if (right != null)
  41.             {
  42.                 g.drawLine(cX, cY, right.cX, right.cY);
  43.             }
  44.         }
  45.     }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post