/** Node visitor */ public void visit(SafraTree tree, SafraTreeNode node) { if (node.getChildCount() <= 1) { return; } BitSet already_seen = new BitSet(); bool first = true; //for (SafraTreeNode::child_iterator it=node->children_begin();it!=node->children_end();++it) SafraTreeNode it = node.children_begin(); while (it != node.children_end()) { SafraTreeNode cur_child = it; if (first) { already_seen = new BitSet(cur_child.getLabeling()); ////////////get the NBA states in child first = false; it = it.increment(); ////////note added } else { BitSet current = new BitSet(cur_child.getLabeling()); BitSet intersection = new BitSet(already_seen); // make copy if (intersection.intersects(current)) { // There are some labels, which occur in older brothers, // remove them from current node and its children STVisitor_subtract_labeling stv_sub = new STVisitor_subtract_labeling(intersection); tree.walkSubTreePostOrder(stv_sub, cur_child); } already_seen.Union(current); it = it.increment(); } } }
/** Node visitor */ public void visit(SafraTree tree, SafraTreeNode node) { if (node.getChildCount() <= 1) { return; } BitSet already_seen = new BitSet(); bool first = true; //for (SafraTreeNode::child_iterator it=node->children_begin();it!=node->children_end();++it) SafraTreeNode it = node.children_begin(); while (it != node.children_end()) { SafraTreeNode cur_child = it; if (first) { already_seen = new BitSet(cur_child.getLabeling());////////////get the NBA states in child first = false; it = it.increment();////////note added } else { BitSet current = new BitSet(cur_child.getLabeling()); BitSet intersection = new BitSet(already_seen); // make copy if (intersection.intersects(current)) { // There are some labels, which occur in older brothers, // remove them from current node and its children STVisitor_subtract_labeling stv_sub = new STVisitor_subtract_labeling(intersection); tree.walkSubTreePostOrder(stv_sub, cur_child); } already_seen.Union(current); it = it.increment(); } } }