Exemplo n.º 1
0
        public List <Class_alfabeto> tablaEpsido()
        {
            List <Class_alfabeto> lista = new List <Class_alfabeto>();

            Class_nodos aux      = this.inicio;
            Class_nodos auxnext2 = new Class_nodos();

            while (aux != null)
            {
                Class_alfabeto n = new Class_alfabeto();   n.setAlfabeto(this.alfabeto);
                n.setnumeroNodo(aux.getContadorNodo().ToString());
                for (int j = 0; j < aux.getListTransiciones().Count(); j++)
                {
                    n.setnumeroNodo(aux.getContadorNodo().ToString());  // agrego el numero del nodo en el cual recorro
                    n.addIntervalo(aux.getListTransiciones()[j]);       //añado la transicion en la cual estoy recorriendo
                    n.setEstado_aceptacion(aux.getEstado_aceptacion()); //////////////////////////////////////////// se añadio para pasar estado de aceptacion
                }
                lista.Add(n);



                if (aux.getNext2() != null)
                {
                    auxnext2 = aux.getNext2();
                    Class_alfabeto n2 = new Class_alfabeto(); n2.setAlfabeto(this.alfabeto);
                    n2.setnumeroNodo(auxnext2.getContadorNodo().ToString());


                    while (auxnext2 != null)
                    {
                        for (int j = 0; j < auxnext2.getListTransiciones().Count(); j++)
                        {
                            n2.setnumeroNodo(auxnext2.getContadorNodo().ToString()); // agrego el numero del nodo en el cual recorro
                            n2.addIntervalo(auxnext2.getListTransiciones()[j]);      //añado la transicion en la cual estoy recorriendo
                        }

                        lista.Add(n2);
                        n2       = new Class_alfabeto();
                        auxnext2 = auxnext2.getNext1();
                    }
                }
                n   = new Class_alfabeto();
                aux = aux.getNext1();
            }

            return(lista);
        }
Exemplo n.º 2
0
        public string generarTxt()
        {
            string      linea1      = "digraph finite_state_machine { \n";
            string      linea2      = "rankdir = LR; size = \"20\" \n";
            string      linea3      = "node[shape = doublecircle margin = 0 fontcolor = white fontsize = 15 width = 0.5 style = filled, fillcolor = black];  N" + this.final.getContadorNodo() + "\n";
            string      linea4      = "node[margin = 0 fontcolor = white fontsize = 15 width = 0.5 shape = circle]; \n";
            string      lineafinal  = "} \n";
            string      nodos       = "";
            string      direcciones = "";
            Class_nodos aux         = this.inicio;
            Class_nodos auxnext2    = new Class_nodos();
            Class_nodos auxnext3    = new Class_nodos();
            Class_nodos auxnext4    = new Class_nodos();
            Class_nodos auxnext5    = new Class_nodos();

            while (aux != null)
            {
                nodos = nodos + "N" + aux.getContadorNodo() + "; \n";
                for (int j = 0; j < aux.getListTransiciones().Count(); j++)
                {
                    direcciones = direcciones + "N" + aux.getContadorNodo() + "-> N" + aux.getListTransiciones()[j].getDireccion() + "[label = \"" + aux.getListTransiciones()[j].getNombre() + "\"];  \n";
                }
                if (aux.getNext2() != null)
                {
                    auxnext2 = aux.getNext2();
                    while (auxnext2 != null)
                    {
                        nodos = nodos + "N" + auxnext2.getContadorNodo() + ";  \n";
                        for (int j = 0; j < auxnext2.getListTransiciones().Count(); j++)
                        {
                            direcciones = direcciones + "N" + auxnext2.getContadorNodo() + "-> N" + auxnext2.getListTransiciones()[j].getDireccion() + "[label = \"" + auxnext2.getListTransiciones()[j].getNombre() + "\"]; \n";
                        }


                        if (auxnext2.getNext2() != null)
                        {
                            auxnext3 = auxnext2.getNext2();
                            while (auxnext3 != null)
                            {
                                nodos = nodos + "N" + auxnext3.getContadorNodo() + ";  \n";
                                for (int j = 0; j < auxnext3.getListTransiciones().Count(); j++)
                                {
                                    direcciones = direcciones + "N" + auxnext3.getContadorNodo() + "-> N" + auxnext3.getListTransiciones()[j].getDireccion() + "[label = \"" + auxnext3.getListTransiciones()[j].getNombre() + "\"]; \n";
                                }



                                if (auxnext3.getNext2() != null)
                                {
                                    auxnext4 = auxnext3.getNext2();
                                    while (auxnext4 != null)
                                    {
                                        nodos = nodos + "N" + auxnext4.getContadorNodo() + ";  \n";
                                        for (int j = 0; j < auxnext4.getListTransiciones().Count(); j++)
                                        {
                                            direcciones = direcciones + "N" + auxnext4.getContadorNodo() + "-> N" + auxnext4.getListTransiciones()[j].getDireccion() + "[label = \"" + auxnext4.getListTransiciones()[j].getNombre() + "\"]; \n";
                                        }



                                        if (auxnext4.getNext2() != null)
                                        {
                                            auxnext5 = auxnext4.getNext2();
                                            while (auxnext5 != null)
                                            {
                                                nodos = nodos + "N" + auxnext5.getContadorNodo() + ";  \n";
                                                for (int j = 0; j < auxnext5.getListTransiciones().Count(); j++)
                                                {
                                                    direcciones = direcciones + "N" + auxnext5.getContadorNodo() + "-> N" + auxnext5.getListTransiciones()[j].getDireccion() + "[label = \"" + auxnext5.getListTransiciones()[j].getNombre() + "\"]; \n";
                                                }

                                                auxnext5 = auxnext5.getNext1();
                                            }
                                        }



                                        auxnext4 = auxnext4.getNext1();
                                    }
                                }



                                auxnext3 = auxnext3.getNext1();
                            }
                        }



                        auxnext2 = auxnext2.getNext1();
                    }
                }
                aux = aux.getNext1();
            }
            string total = linea1 + linea2 + linea3 + linea4 + nodos + direcciones + lineafinal;

            return(total);
        }