public void recreateTree() {
    System.out.println("Recreating tree");
    ArrayList nodes = new ArrayList();
    String attr, crit, result;
    int level;
    node leaf;
    while (!list.isEmpty()) {
      if (((String) list.remove(0)).compareTo("Node") == 0) {
        leaf = new node();
        attr = (String) list.remove(0);
        // System.out.println("ATTR:"+attr);
        crit = (String) list.remove(0);
        try {
          level = (new Double(crit)).intValue();
          crit = null;
        } catch (Exception e) {
          // System.out.println("crit:"+crit);
          level = (new Double((String) list.remove(0))).intValue();
        }
        // System.out.println("lvl:"+level);
        if (level > depth) {
          depth = level;
        }
        if (((String) list.get(0)).compareTo("Node") != 0) {
          result = (String) list.remove(0);
          leaf.setResult(result);
        }
        leaf.setSplitCriteria(crit, 0);
        leaf.setLevel(level);
        leaf.setAttr(attr);

        if (attr.compareTo("_root") == 0) {
          root = leaf;
        } else {

          nodes.add(leaf);
        }
      }
    }
    depth++;
    levelCount(nodes);

    System.out.println("Linking " + nodes.size() + " tree nodes");
    trav(nodes, root);
  }