Esempio n. 1
0
        static void DiagnoseState <T>(StreamWriter writer, AutomatonState state, Mapper <T, AutomatonState> map, bool doKernel)
        {
            // List<T> statePath = ListUtilities.Map<T, AutomatonState>(state.statePath, map);
            IEnumerable <T> statePath = ListUtilities.MapC <T, AutomatonState>(state.statePath, map);

            writer.WriteLine("    Shortest prefix: {0}", ListUtilities.GetStringFromList(state.shortestPrefix, " ", 8));
            writer.WriteLine("    State path: {0}", ListUtilities.GetStringFromList(statePath, "->", 8, false));
            if (state.conflicts != null)
            {
                writer.WriteLine();
                writer.WriteLine("    <b>Conflicts in this state</b>");
                foreach (Conflict conflict in state.conflicts)
                {
                    conflict.HtmlReport(writer);
                }
            }
            if (doKernel)
            {
                writer.WriteLine("    Kernel items --");
                foreach (ProductionItem item in state.kernelItems)
                {
                    writer.WriteLine("      {0}", ItemToString(item, false));
                }
            }
            writer.WriteLine();
        }
Esempio n. 2
0
        static void DiagnoseState <T>(StreamWriter writer, AutomatonState state, Mapper <T, AutomatonState> map)
        {
            // List<T> statePath = ListUtilities.Map<T, AutomatonState>(state.statePath, map);
            IEnumerable <T> statePath = ListUtilities.MapC <T, AutomatonState>(state.statePath, map);
            IEnumerable <T> predList  = ListUtilities.MapC <T, AutomatonState>(state.predecessors, map);

            writer.WriteLine("    Shortest prefix: {0}", ListUtilities.GetStringFromList(state.shortestPrefix, " ", 8));
            writer.WriteLine("    Shortest path: {0}", ListUtilities.GetStringFromList(statePath, "->", 19, (ListUtilities.BreakRule) 16));
            writer.WriteLine("    Predecessors: {0}", ListUtilities.GetStringFromList(predList, ", ", 18, (ListUtilities.BreakRule) 16));
            writer.Write(KernelToString(state));

            if (state.conflicts != null)
            {
                writer.WriteLine();
                writer.WriteLine("    <b>Conflicts in this state</b>");
                foreach (Conflict conflict in state.conflicts)
                {
                    conflict.HtmlReport(writer);
                }
            }
            writer.WriteLine();
        }