Exemple #1
0
                /** Node visitor */
                public void visit(SafraTree tree, SafraTreeNode node)
                {
                    bool all_final = true;

                    //for (BitSetIterator it=BitSetIterator(node->getLabeling());it!=BitSetIterator::end(node->getLabeling());++it)
                    //BitSet label_this = node.getLabeling();
                    //for (int it = 0; it < label_this.Count; it++)
                    for (int it = BitSetIterator.start(node.getLabeling()); it != BitSetIterator.end(node.getLabeling()); it = BitSetIterator.increment(node.getLabeling(), it))
                    {
                        ////	if (!_nba_states_with_all_succ_final.get(*it)) {
                        if (!_nba_states_with_all_succ_final.get(it))
                        {
                            all_final = false;
                            break;
                        }
                    }

                    if (all_final)
                    {
                        // remove all children of node & set final flag
                        STVisitor_remove_subtree stv_remove = new STVisitor_remove_subtree(_tree_template);
                        tree.walkChildrenPostOrder(stv_remove, node);

                        node.setFinalFlag();

                        _success = true;
                    }
                }
Exemple #2
0
            /** Node visitor */
            public void visit(SafraTree tree, SafraTreeNode node)
            {
                if (node.getChildCount() == 0)
                {
                    return;
                }

                BitSet labeling_union = new BitSet();
                //for (SafraTreeNode::child_iterator it=node->children_begin();it!=node->children_end();++it)
                SafraTreeNode it = node.children_begin();

                while (it != node.children_end())
                {
                    labeling_union.Union(it.getLabeling());
                    it = it.increment();
                }

                if (labeling_union == node.getLabeling())
                {
                    // The union of the labelings of the children is exactly the
                    // same as the labeling of the parent ->
                    //  remove children
                    STVisitor_remove_subtree stv_remove = new STVisitor_remove_subtree(_tree_template);
                    tree.walkChildrenPostOrder(stv_remove, node);

                    node.setFinalFlag(true);///////////should be "+ i", means in Li
                }
            }
Exemple #3
0
            /** Node visitor */
            public void visit(SafraTree tree, SafraTreeNode node)
            {
                if (node.getChildCount() == 0) { return; }

                BitSet labeling_union = new BitSet();
                //for (SafraTreeNode::child_iterator it=node->children_begin();it!=node->children_end();++it)
                SafraTreeNode it = node.children_begin();
                while (it != node.children_end())
                {
                    labeling_union.Union(it.getLabeling());
                    it = it.increment();
                }

                if (labeling_union == node.getLabeling())
                {
                    // The union of the labelings of the children is exactly the
                    // same as the labeling of the parent ->
                    //  remove children
                    STVisitor_remove_subtree stv_remove = new STVisitor_remove_subtree(_tree_template);
                    tree.walkChildrenPostOrder(stv_remove, node);

                    node.setFinalFlag(true);///////////should be "+ i", means in Li
                }
            }
Exemple #4
0
                /** Node visitor */
                public void visit(SafraTree tree, SafraTreeNode node)
                {
                    bool all_final = true;
                    //for (BitSetIterator it=BitSetIterator(node->getLabeling());it!=BitSetIterator::end(node->getLabeling());++it)
                    //BitSet label_this = node.getLabeling();
                    //for (int it = 0; it < label_this.Count; it++)
                    for (int it = BitSetIterator.start(node.getLabeling()); it != BitSetIterator.end(node.getLabeling()); it = BitSetIterator.increment(node.getLabeling(), it))
                    {
                        ////	if (!_nba_states_with_all_succ_final.get(*it)) {
                        if (!_nba_states_with_all_succ_final.get(it))
                        {
                            all_final = false;
                            break;
                        }
                    }

                    if (all_final)
                    {
                        // remove all children of node & set final flag
                        STVisitor_remove_subtree stv_remove = new STVisitor_remove_subtree(_tree_template);
                        tree.walkChildrenPostOrder(stv_remove, node);

                        node.setFinalFlag();

                        _success = true;
                    }
                }