home *** CD-ROM | disk | FTP | other *** search
- public class Tree {
- public TreeNode root = new TreeNode();
- private static int item;
- private static int count;
- private static TreeNode foundNode;
-
- public Tree() {
- this.root.data = new TreeNodeData();
- }
-
- public TreeNode getRoot() {
- return this.root;
- }
-
- public boolean rootItem() {
- return this.root.nextNode != null;
- }
-
- public TreeNode findItem(int var1) {
- item = var1;
- count = -1;
- this.findLoop(this.root);
- return foundNode;
- }
-
- private void findLoop(TreeNode var1) {
- if (var1 != null) {
- if (count++ == item) {
- foundNode = var1;
- } else {
- this.findLoop(var1.subNode);
- this.findLoop(var1.nextNode);
- }
- }
- }
-
- public void updateNodes(TreeNode var1, TreeNode var2) {
- if (var1 != null) {
- for(TreeNode var3 = var1.lastNode; var3.data.level > 0; var3 = var3.lastNode) {
- var3.data.mark = false;
- }
- }
-
- if (var2 != null) {
- TreeNode var5 = var2.lastNode;
-
- for(TreeNode var4 = var2; var5.data.level > 0; var5 = var5.lastNode) {
- if (var5.subNode == var4) {
- var5.data.mark = true;
- }
-
- var4 = var5;
- }
- }
-
- }
- }
-