本文整理汇总了Java中pal.tree.Node.getNodeHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getNodeHeight方法的具体用法?Java Node.getNodeHeight怎么用?Java Node.getNodeHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pal.tree.Node
的用法示例。
在下文中一共展示了Node.getNodeHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printASCII
import pal.tree.Node; //导入方法依赖的package包/类
public static void printASCII(Tree tree, PrintWriter out) {
tree.createNodeList();
int numExternalNodes = tree.getExternalNodeCount();
int numInternalNodes = tree.getInternalNodeCount();
int numBranches = numInternalNodes + numExternalNodes - 1;
boolean[] umbrella = new boolean[numExternalNodes];
int[] position = new int[numExternalNodes];
int minLength = (Integer.toString(numBranches)).length() + 1;
int MAXCOLUMN = 40;
Node root = tree.getRoot();
if (root.getNodeHeight() == 0.0) {
NodeUtils.lengths2Heights(root);
}
double proportion = (double) MAXCOLUMN / root.getNodeHeight();
for (int n = 0; n < numExternalNodes; n++) {
umbrella[n] = false;
}
position[0] = 1;
for (int i = root.getChildCount() - 1; i > -1; i--) {
printNodeInASCII(out, root.getChild(i), 1, i, root.getChildCount(),
numExternalNodes, umbrella, position, proportion, minLength);
if (i != 0) {
putCharAtLevel(out, 0, '|', position);
out.println();
}
}
}
示例2: printASCII
import pal.tree.Node; //导入方法依赖的package包/类
public static void printASCII(Tree tree, PrintWriter out) {
FormattedOutput format = FormattedOutput.getInstance();
tree.createNodeList();
int numExternalNodes = tree.getExternalNodeCount();
int numInternalNodes = tree.getInternalNodeCount();
int numBranches = numInternalNodes + numExternalNodes - 1;
boolean[] umbrella = new boolean[numExternalNodes];
int[] position = new int[numExternalNodes];
int minLength = (Integer.toString(numBranches)).length() + 1;
int MAXCOLUMN = 40;
Node root = tree.getRoot();
if (root.getNodeHeight() == 0.0) {
NodeUtils.lengths2Heights(root);
}
double proportion = (double) MAXCOLUMN / root.getNodeHeight();
for (int n = 0; n < numExternalNodes; n++) {
umbrella[n] = false;
}
position[0] = 1;
for (int i = root.getChildCount() - 1; i > -1; i--) {
printNodeInASCII(out, root.getChild(i), 1, i, root.getChildCount(),
numExternalNodes, umbrella, position, proportion, minLength);
if (i != 0) {
putCharAtLevel(out, 0, '|', position);
out.println();
}
}
}
示例3: safeNodeHeight
import pal.tree.Node; //导入方法依赖的package包/类
/**
* Calculates the safe node height.
*
* @param tree the tree
* @param node the node
*
* @return the height of the node
*/
public static double safeNodeHeight(final Tree tree, final Node node) {
if (node.getNodeHeight() > 0.0) {
return node.getNodeHeight();
}
return TreeUtilities.nodeDistance(node);
}
示例4: safeNodeHeight
import pal.tree.Node; //导入方法依赖的package包/类
/**
* Calculates the safe node height.
*
* @param tree the tree
* @param node the node
*
* @return the height of the node
*/
public static double safeNodeHeight(final Tree tree, final Node node) {
if (node.getNodeHeight() > 0.0) {
return node.getNodeHeight();
}
return TreeUtils.nodeDistance(node);
}