/// <summary>  Generate automata using Tabakov and Vardi's approach
        ///
        /// </summary>
        /// <param name="num">
        /// </param>
        /// <returns> a random finite automaton
        /// </returns>
        /// <author>  Yu-Fang Chen
        /// </author>
        public static FiniteAutomaton genRandomTV(int size, float td, float fd, int alphabetSize)
        {
            FiniteAutomaton result = 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'"
            TreeMap <Integer, FAState> st = new TreeMap <Integer, FAState>();

            td = td / size;
            System.Random r = new System.Random();

            for (int i = 0; i < size; i++)
            {
                st.put(i, result.createState());
                float rm = (float)r.NextDouble();
                if (fd > rm)
                {
                    result.F.add(st.get_Renamed(i));
                }
            }
            result.setInitialState(st.get_Renamed(0));
            result.F.add(st.get_Renamed(0));
            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    for (int k = 0; k < alphabetSize; k++)
                    {
                        if (td > (float)r.NextDouble())
                        {
                            result.addTransition(st.get_Renamed(i), st.get_Renamed(j), ("a" + k));
                        }
                    }
                }
            }
            return(result);
        }
Пример #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'"
                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);
        }
Пример #3
0
        /// <summary> Simplify a finite automaton by merging simulation equivalent states</summary>
        /// <param name="fa:">a finite automaton
        /// </param>
        /// <param name="Sim:">some simulation relation over states in the input automaton
        ///
        /// </param>
        /// <returns> an equivalent finite automaton
        /// </returns>
        private FiniteAutomaton quotient(FiniteAutomaton fa)
        {
            FiniteAutomaton result = 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'"
            TreeMap <FAState, FAState> map = new TreeMap <FAState, FAState>();
            //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'"
            TreeMap <FAState, FAState> reducedMap = new TreeMap <FAState, 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 (state_it.hasNext())
            {
                FAState state = state_it.next();
                map.put(state, state);
                //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 (state_it2.hasNext())
                {
                    FAState state2 = state_it2.next();
                    //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>(state, state2)) &&
                        rel.contains(new Pair <FAState, FAState>(state2, state)))
                    {
                        map.put(state, state2);
                    }
                }
            }

            FAState init = result.createState();

            reducedMap.put(map.get_Renamed(fa.InitialState), init);
            result.InitialState = init;

            state_it = fa.states.iterator();
            while (state_it.hasNext())
            {
                FAState state = state_it.next();
                if (!reducedMap.containsKey(map.get_Renamed(state)))
                {
                    reducedMap.put(map.get_Renamed(state), result.createState());
                }
                if (fa.F.contains(state))
                {
                    result.F.add(reducedMap.get_Renamed(map.get_Renamed(state)));
                }
                //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 (sym_it.hasNext())
                {
                    System.String sym = sym_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 (to_it.hasNext())
                    {
                        FAState to = to_it.next();
                        if (!reducedMap.containsKey(map.get_Renamed(to)))
                        {
                            reducedMap.put(map.get_Renamed(to), result.createState());
                        }
                        result.addTransition(reducedMap.get_Renamed(map.get_Renamed(state)), reducedMap.get_Renamed(map.get_Renamed(to)), sym);
                    }
                }
            }
            //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> > newRel = new TreeSet <Pair <FAState, FAState> >(new StatePairComparator());
            //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'"
            Iterator <Pair <FAState, FAState> > sim_it = rel.iterator();

            while (sim_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'"
                Pair <FAState, FAState> sim = sim_it.next();
                //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'"
                newRel.add(new Pair <FAState, FAState>(reducedMap.get(map.get(sim.getLeft())), reducedMap.get(map.get(sim.getRight()))));
            }
            rel.clear();
            rel = newRel;

            return(result);
        }
Пример #4
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);
        }