Example #1
0
/*
 * Function: pset
 */
        private void pset(ArrayList dtrans_group)
        {
            int size = dtrans_group.Count;

            for (int i = 0; i < size; ++i)
            {
                DTrans dtrans = (DTrans)dtrans_group[i];
                Console.Write(dtrans.GetLabel().ToString() + " ");
            }
        }
Example #2
0
/*
 * Function: init_groups
 */
        private void init_groups()
        {
            bool group_found;

            int group_count = 0;

            group = new ArrayList();

            int size = spec.dtrans_list.Count;

            ingroup = new int[size];

            for (int i = 0; i < size; ++i)
            {
                group_found = false;
                DTrans dtrans = (DTrans)spec.dtrans_list[i];

#if DEBUG
                Utility.assert(i == dtrans.GetLabel());
                Utility.assert(false == group_found);
                Utility.assert(group_count == group.Count);
#endif

                for (int j = 0; j < group_count; j++)
                {
                    ArrayList dtrans_group = (ArrayList)group[j];
#if DEBUG
                    Utility.assert(false == group_found);
                    Utility.assert(0 < dtrans_group.Count);
#endif
                    DTrans first = (DTrans)dtrans_group[0];

#if DEBUG
                    int s = dtrans_group.Count;
                    Utility.assert(0 < s);

                    for (int k = 1; k < s; k++)
                    {
                        DTrans check = (DTrans)dtrans_group[k];
                        Utility.assert(check.GetAccept() == first.GetAccept());
                    }
#endif

                    if (first.GetAccept() == dtrans.GetAccept())
                    {
                        dtrans_group.Add(dtrans);
                        ingroup[i]  = j;
                        group_found = true;

#if DEBUG
                        Utility.assert(j == ingroup[dtrans.GetLabel()]);
#endif
                        break;
                    }
                }

                if (!group_found)
                {
                    ArrayList dtrans_group = new ArrayList();
                    dtrans_group.Add(dtrans);
                    ingroup[i] = group.Count;
                    group.Add(dtrans_group);
                    group_count++;
                }
            }

#if OLD_DUMP_DEBUG
            Console.WriteLine("Initial grouping:");
            pgroups();
            Console.WriteLine("");
#endif
        }