/** * @param cell * the cell whose tree node is to be obtained * @return the tree node corresponding to the specified cell */ public TreeNode getTreeNode(Object cell) { if (cell == null) cell = virtualRootCell; if (cell != null) { TreeNode node = (TreeNode) nodes.get(cell); if (node == null) { node = new TreeNode(cell); nodes.put(cell, node); } return node; } return null; }
/** * @return the depth of this node in the tree */ public int getDepth() { int depth = 1; Iterator itr = children.iterator(); while (itr.hasNext()) { TreeNode node = (TreeNode) itr.next(); int childDepth = node.getDepth(); if (childDepth >= depth) { depth = childDepth + 1; } } return depth; }
/** * * @return the right-most limit of the sub-tree beneath this node */ public double rightLimit() { return Math.max(normalize(rightBisector), (rightTangent)); }
parent = (TreeNode) nitr.next(); List children = parent.getChildren(); double rightLimit = parent.rightLimit(); double angleSpace = (parent.leftLimit() - rightLimit) / children.size(); for (i = angleOffset; itr.hasNext(); i++) { node = (TreeNode) itr.next(); Object cell = node.getCell(); if (node.hasChildren()) { parentNodes.add(node);
return; double depth = tree.getDepth();
/** * * @return the left-most limit of the sub-tree beneath this node */ public double leftLimit() { return Math.min(normalize(leftBisector), (leftTangent)); }