⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 walker.java

📁 toocom源代码,主要应用在本体匹配方面!
💻 JAVA
字号:
package toocom.graphdrawing;

import java.util.LinkedList;
/**
 * This class display a tree in two dimensions by using the optimised Walker algorithm, 
 * that is an optimized version of the Reingold-Tilford algorithm.
 *
 * @author Stefan Petrik
 * @version 23/12/2003
 */
public final class Walker{
 
  private static int viewDepth;
  private static int max_ordonnee;
  private static TreeNode defAncestor;
  private static double shift;
  private static double change;
  private static double midpoint;
  private static double distance;

  /** Returns the max y coordinate for the display of the tree that has r
   *  as root. */
  public static int layoutTree(TreeNode r, double heightBox){
  	viewDepth = 1;
  	distance = heightBox + 10.0;
    shift = change = 0.0;
    midpoint = 0.0;
    max_ordonnee = 0;
    firstWalk(r);
    secondWalk(r,-r.prelim);
    return max_ordonnee;
  }

  private static void firstWalk(TreeNode v){
    TreeNode w;
    if(v.isLeaf()){
      v.prelim = 0.0;
      if (viewDepth < v.getLevel() - 1) viewDepth = v.getLevel() - 1;
    }
    else{
      defAncestor = (TreeNode)v.getFirstChild();//ain

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -