Beispiel #1
0
        private void  InitBlock()
        {
            if (!Head.containsKey(g.toString()))
            {
                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                H = new TreeSet <Integer>();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (arc_g_it.hasNext())
                {
                    Arc arc_g = arc_g_it.next();
                    if (arc_g.From == init)
                    {
                        H.add(arc_g.To);
                    }
                }
                Head.put(g.toString(), H);
            }

            if (!Tail.containsKey(h.toString()))
            {
                FiniteAutomaton fa = new FiniteAutomaton();
                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                OneToOneTreeMap <Integer, FAState> st = new OneToOneTreeMap <Integer, FAState>();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (arc_h_it.hasNext())
                {
                    Arc arc_h = arc_h_it.next();
                    if (!st.containsKey(arc_h.From))
                    {
                        st.put(arc_h.From, fa.createState());
                    }
                    if (!st.containsKey(arc_h.To))
                    {
                        st.put(arc_h.To, fa.createState());
                    }
                    fa.addTransition(st.getValue(arc_h.From), st.getValue(arc_h.To), arc_h.Label?"1":"0");
                }
                SCC s = new SCC(fa);
                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                T = new TreeSet <Integer>();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (s_it.hasNext())
                {
                    T.add(st.getKey(s_it.next()));
                }
                int TailSize = 0;
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (TailSize != T.size())
                {
                    TailSize = T.size();
                    //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                    TreeSet <Arc> isolatedArcsTemp = new TreeSet <Arc>();
                    //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                    while (arc_it.hasNext())
                    {
                        Arc arc = arc_it.next();
                        if (!T.contains(arc.To))
                        {
                            isolatedArcsTemp.add(arc);
                        }
                        else
                        {
                            T.add(arc.From);
                        }
                    }
                    isolatedArcs = isolatedArcsTemp;
                }
                Tail.put(h.toString(), T);
            }
            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
            TreeSet <Integer> intersection = new TreeSet <Integer>();

            intersection.addAll(Head.get_Renamed(g.toString()));
            intersection.retainAll(Tail.get_Renamed(h.toString()));
            if (debug_Renamed_Field)
            {
                if (intersection.isEmpty())
                {
                    debug("g:" + g + ", Head: " + Head.get_Renamed(g.toString()));
                    debug("h:" + h + ", Tail: " + Tail.get_Renamed(h.toString()));
                }
            }
            return(!intersection.isEmpty());

            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
            ArrayList <TreeSet <Arc> > graphs = new ArrayList <TreeSet <Arc> >();

            //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
            while (symbol_it.hasNext())
            {
                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                TreeSet <Arc> graph = new TreeSet <Arc>();

                System.String sym = symbol_it.next();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (from_it.hasNext())
                {
                    cav2010.automata.FAState from = from_it.next();
                    if (from.getNext(sym) != null)
                    {
                        //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                        while (to_it.hasNext())
                        {
                            cav2010.automata.FAState to = to_it.next();
                            if (input.F.contains(from) || input.F.contains(to))
                            {
                                graph.add(new Arc(from.id, true, to.id));
                            }
                            else
                            {
                                graph.add(new Arc(from.id, false, to.id));
                            }
                        }
                    }
                }
                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                ArrayList <TreeSet <Arc> > toRemove = new ArrayList <TreeSet <Arc> >();
                bool canAdd = true;
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (old_it.hasNext())
                {
                    //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                    if (smallerThan(old, graph))
                    {
                        canAdd = false;
                        break;
                    }
                    else if (smallerThan(graph, old))
                    {
                        toRemove.add(old);
                    }
                }
                if (canAdd)
                {
                    graphs.add(graph);
                    graphs.removeAll(toRemove);
                }
            }
            return(graphs);

            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
            TreeSet <Arc> f = new TreeSet <Arc>();

            //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
            while (arc_g_it.hasNext())
            {
                Arc arc_g = arc_g_it.next();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (arc_h_it.hasNext())
                {
                    Arc arc_h = arc_h_it.next();
                    if (arc_g.To == arc_h.From)
                    {
                        if (arc_g.Label || arc_h.Label)
                        {
                            f.add(new Arc(arc_g.From, true, arc_h.To));
                            f.remove(new Arc(arc_g.From, false, arc_h.To));
                        }
                        else
                        {
                            if (!f.contains(new Arc(arc_g.From, true, arc_h.To)))
                            {
                                f.add(new Arc(arc_g.From, false, arc_h.To));
                            }
                        }
                    }
                }
            }
            return(f);

            //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
            while (arc_g_it.hasNext())
            {
                Arc  arc_g      = arc_g_it.next();
                bool has_larger = false;
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (arc_h_it.hasNext())
                {
                    Arc arc_h = arc_h_it.next();
                    if (arc_g.From == arc_h.From)
                    {
                        if (!arc_g.Label || arc_h.Label)
                        {
                            if (arc_g.To == arc_h.To)
                            {
                                has_larger = true;
                                break;
                            }
                        }
                    }
                }
                if (!has_larger)
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #2
0
        private void  InitBlock()
        {
            if (!Head.containsKey(g.toString()))
            {
                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                TreeSet <Integer> H = new TreeSet <Integer>();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (arc_g_it.hasNext())
                {
                    Arc arc_g = arc_g_it.next();
                    if (arc_g.From == init)
                    {
                        H.add(arc_g.To);
                    }
                }
                Head.put(g.toString(), H);
            }
            if (!Tail.containsKey(h.toString()))
            {
                FiniteAutomaton fa = new FiniteAutomaton();
                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                OneToOneTreeMap <Integer, cav2010.automata.FAState> st = new OneToOneTreeMap <Integer, cav2010.automata.FAState>();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (arc_h_it.hasNext())
                {
                    Arc arc_h = arc_h_it.next();
                    if (!st.containsKey(arc_h.From))
                    {
                        st.put(arc_h.From, fa.createState());
                    }
                    if (!st.containsKey(arc_h.To))
                    {
                        st.put(arc_h.To, fa.createState());
                    }
                    fa.addTransition(st.getValue(arc_h.From), st.getValue(arc_h.To), arc_h.Label?"1":"0");
                }
                SCC s = new SCC(fa);
                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                TreeSet <Integer> T = new TreeSet <Integer>();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (s_it.hasNext())
                {
                    T.add(st.getKey(s_it.next()));
                }
                int TailSize = 0;
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (TailSize != T.size())
                {
                    TailSize = T.size();
                    //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                    TreeSet <Arc> isolatedArcsTemp = new TreeSet <Arc>();
                    //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                    while (arc_it.hasNext())
                    {
                        Arc arc = arc_it.next();
                        if (!T.contains(arc.To))
                        {
                            isolatedArcsTemp.add(arc);
                        }
                        else
                        {
                            T.add(arc.From);
                        }
                    }
                    isolatedArcs = isolatedArcsTemp;
                }
                Tail.put(h.toString(), T);
            }
            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
            TreeSet <Integer> intersection = new TreeSet <Integer>();

            intersection.addAll(Head.get_Renamed(g.toString()));
            intersection.retainAll(Tail.get_Renamed(h.toString()));

            if (debug_Renamed_Field)
            {
                if (intersection.isEmpty())
                {
                    debug("g:" + g + ", Head: " + Head.get_Renamed(g.toString()));
                    debug("h:" + h + ", Tail: " + Tail.get_Renamed(h.toString()));
                }
            }

            return(!intersection.isEmpty());

            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
            TreeSet <Arc> result = new TreeSet <Arc>();

            //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
            while (arc_it1.hasNext())
            {
                Arc  cur    = arc_it1.next();
                bool canAdd = true;
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (arc_it2.hasNext())
                {
                    Arc other = arc_it2.next();
                    if (cur.From == other.From)
                    {
                        if (!cur.Label || other.Label)
                        {
                            if (cur.To != other.To)
                            {
                                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                                if (rel.contains(new Pair <FAState, FAState>(new FAState(cur.getTo()), new FAState(other.getTo()))) &&
                                    result.contains(other))
                                {
                                    canAdd = false;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (canAdd)
                {
                    result.add(cur);
                }
            }
            return(result);

            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
            ArrayList <TreeSet <Arc> > graphs = new ArrayList <TreeSet <Arc> >();

            //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
            while (symbol_it.hasNext())
            {
                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                TreeSet <Arc> graph = new TreeSet <Arc>();

                System.String sym = symbol_it.next();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (from_it.hasNext())
                {
                    FAState from = from_it.next();
                    if (from.getNext(sym) != null)
                    {
                        //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                        while (to_it.hasNext())
                        {
                            FAState to = to_it.next();
                            if (input.F.contains(from) || input.F.contains(to))
                            {
                                graph.add(new Arc(from.id, true, to.id));
                            }
                            else
                            {
                                graph.add(new Arc(from.id, false, to.id));
                            }
                        }
                    }
                }

                //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                ArrayList <TreeSet <Arc> > toRemove = new ArrayList <TreeSet <Arc> >();
                bool canAdd = true;
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (old_it.hasNext())
                {
                    //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                    if (smallerThan(old, graph, rel))
                    {
                        canAdd = false;
                        break;
                    }
                    else if (smallerThan(graph, old, rel))
                    {
                        toRemove.add(old);
                    }
                }
                if (canAdd)
                {
                    if (opt2)
                    {
                        graphs.add(min(graph));
                    }
                    else
                    {
                        graphs.add(graph);
                    }
                    graphs.removeAll(toRemove);
                }
            }
            return(graphs);

            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
            TreeSet <Arc> f = new TreeSet <Arc>();

            //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
            while (arc_g_it.hasNext())
            {
                Arc arc_g = arc_g_it.next();
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (arc_h_it.hasNext())
                {
                    Arc arc_h = arc_h_it.next();
                    if (arc_g.To == arc_h.From)
                    {
                        if (arc_g.Label || arc_h.Label)
                        {
                            f.add(new Arc(arc_g.From, true, arc_h.To));
                            f.remove(new Arc(arc_g.From, false, arc_h.To));
                        }
                        else
                        {
                            if (!f.contains(new Arc(arc_g.From, true, arc_h.To)))
                            {
                                f.add(new Arc(arc_g.From, false, arc_h.To));
                            }
                        }
                    }
                }
            }
            return(f);

            //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
            while (arc_g_it.hasNext())
            {
                Arc  arc_g      = arc_g_it.next();
                bool has_larger = false;
                //UPGRADE_NOTE: There is an untranslated Statement.  Please refer to original code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1153'"
                while (arc_h_it.hasNext())
                {
                    Arc arc_h = arc_h_it.next();
                    if (arc_g.From == arc_h.From)
                    {
                        if (!arc_g.Label || arc_h.Label)
                        {
                            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
                            if (rel.contains(new Pair <FAState, FAState>(new FAState(arc_g.getTo()), new FAState(arc_h.getTo()))))
                            {
                                has_larger = true;
                                break;
                            }
                        }
                    }
                }
                if (!has_larger)
                {
                    return(false);
                }
            }
            return(true);

            FAState[] states  = input.states.toArray(new FAState[0]);
            bool[]    isFinal = new bool[states.Length];
            bool[][]  fsim    = new bool[states.Length][];
            for (int i = 0; i < states.Length; i++)
            {
                fsim[i] = new bool[states.Length];
            }
            // sim[u][v]=true iff v in sim(u) iff v simulates u

            for (int i = 0; i < states.Length; i++)
            {
                isFinal[i] = input.F.contains(states[i]);
            }
            for (int i = 0; i < states.Length; i++)
            {
                for (int j = i; j < states.Length; j++)
                {
                    fsim[i][j] = (!isFinal[i] || isFinal[j]) && states[j].covers(states[i]);
                    fsim[j][i] = (isFinal[i] || !isFinal[j]) && states[i].covers(states[j]);
                }
            }
            Simulation sim = new Simulation();
            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
            Set <Pair <FAState, FAState> > FSim = sim.FastFSimRelNBW(input, fsim);

            return(FSim);
        }