1 |
/* DefaultMutableTreeNode.java -- |
/* DefaultMutableTreeNode.java -- |
2 |
Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
502 |
return depth; |
return depth; |
503 |
} |
} |
504 |
|
|
|
static Random random = new Random(System.currentTimeMillis()); |
|
|
|
|
|
public static void growTree(DefaultMutableTreeNode root) |
|
|
{ |
|
|
DefaultMutableTreeNode node; |
|
|
|
|
|
DefaultMutableTreeNode current = root; |
|
|
int index = 0; |
|
|
|
|
|
do |
|
|
{ |
|
|
if (random.nextBoolean()) |
|
|
{ |
|
|
node = new DefaultMutableTreeNode(String.valueOf(index)); |
|
|
index++; |
|
|
current.add(node); |
|
|
current = node; |
|
|
} |
|
|
else |
|
|
{ |
|
|
current = (DefaultMutableTreeNode) current.getParent(); |
|
|
} |
|
|
} |
|
|
while (current != root |
|
|
&& current != null); |
|
|
} |
|
|
|
|
505 |
/** |
/** |
506 |
* getLevel |
* getLevel |
507 |
* |
* |