public void ShowAlfabet(List <Lista_ER> alfabet, string name)
        {
            string text = "digraph H {\n" +
                          "aHtmlTable [\n shape = plaintext\n" +
                          "label =<\n" +
                          "<table border = '0' cellborder = '1' color = 'blue' cellspacing = '0'>\n";

            for (int f = 0; f < fila; f++)
            {
                text += "<tr>";
                for (int c = 0; c < columna; c++)
                {
                    text += "<td>" + table_matriz[f, c] + "</td>";
                }
                text += "</tr>\n";
            }

            text += "</table>\n" +
                    ">];\n" +
                    "}";

            //Console.WriteLine(text);
            Graficar_AFN g = new Graficar_AFN();

            g.graficar(text, name);
        }
        public void graph(string name)
        {
            string text = "digraph " + name + " {\n";

            text += "\trankdir=LR;" + "\n";

            text += "\tgraph [label=\"" + name + "\", labelloc=t, fontsize=18]; \n";
            text += "\tnode [style = filled];";
            text += "\tnode [shape=point];inicio;";
            text += "\n";
            text += "\tnode [shape=circle];" + "\n";

            for (int i = 0; i < Description_AFD.Count; i++)
            {
                text += "\n";
                text += "\t";
                text += Description_AFD.ElementAt(i).Description_graphviz(i);
            }

            for (int i = 0; i < Table_States.Count; i++)
            {
                if (Table_States.ElementAt(i).final == true)
                {
                    text += "\n";
                    text += "\t";
                    text += Table_States.ElementAt(i).Name_Char + "[shape=doublecircle];";
                }
            }

            text += "\n }";
            Graficar_AFN g = new Graficar_AFN();

            g.graficar(text, name);
        }
Beispiel #3
0
        public void graph(string name)
        {
            string texto = "digraph " + name + " {\n";

            texto += "\trankdir=LR;" + "\n";

            texto += "\tgraph [label=\"" + name + "\", labelloc=t, fontsize=18]; \n";
            texto += "\tnode [style = filled];";

            foreach (Estado e in this.States)
            {
                texto += " " + e.Identifier;
            }

            texto += ";" + "\n";
            texto += "\tnode [shape=circle];" + "\n";

            texto += "\tnode [shape=point];inicio;\n" + "	inicio -> "+ this.Initial.Identifier + " [label=\"inicio\"];" + "\n";
            List <string>     duplicados        = new List <string>();
            List <Estado>     FiltroEstados     = new List <Estado>();
            List <Trancision> FiltroTancisiones = new List <Trancision>();
            Trancision        transicion        = new Trancision();

            foreach (Estado e in this.States)
            {
                Estado            ee           = e;
                List <Trancision> trancisiones = e.Transitions;

                foreach (Trancision t in trancisiones)
                {
                    if (duplicados.Find(x => x.Equals(t.Begin.Identifier + " -> " + t.End.Identifier + " [label=\"" + t.Symbol.getEtiqueta() + "\"];")) == null)
                    {
                        transicion = t;
                        FiltroTancisiones.Add(t);
                        duplicados.Add(t.Begin.Identifier + " -> " + t.End.Identifier + " [label=\"" + t.Symbol.getEtiqueta() + "\"];");
                        texto += "\t" + t.Begin.Identifier + " -> " + t.End.Identifier + " [label=\"" + t.Symbol.getEtiqueta() + "\"];" + "\n";
                    }
                }

                //ee.Transitions = FiltroTancisiones;
                FiltroEstados.Add(ee);
                FiltroTancisiones = new List <Trancision>();
            }

            texto += transicion.End.Identifier + "[shape=doublecircle]";
            texto += "}";
            // this.States = FiltroEstados;

            Graficar_AFN niu = new Graficar_AFN();

            niu.graficar(texto, name);
        }