Ejemplo n.º 1
0
    protected void OnCombobox3Changed(object sender, EventArgs e)
    {
        string[]         indice = combobox3.ActiveText.Split(' ');
        ExpressaoRegular temp   = expressoes[Int32.Parse(indice[1])];
        string           texto  = temp.regex;

        textview3.Buffer.Text = texto;
    }
Ejemplo n.º 2
0
    protected void OnButton1952Clicked(object sender, EventArgs e)
    {
        string           expressao = textview3.Buffer.Text;
        ExpressaoRegular ER        = new ExpressaoRegular(expressao);

        expressoes.Add(ER);
        atualizarListaER();
    }
Ejemplo n.º 3
0
    public void converterER(int indice)
    {
        ExpressaoRegular ER           = expressoes[indice];
        Automato         temp         = ER.transformaERemAFD();
        List <string>    estados1     = new List <string>();
        List <string>    simbolos     = new List <string>();
        List <string[]>  transicao    = new List <string[]> ();
        HashSet <string> tempEstados1 = new HashSet <string> ();
        HashSet <string> tempSimbolos = new HashSet <string> ();

        foreach (var t in temp.transicoes)
        {
            string estado = "";
            foreach (string s in temp.estadosFinais)
            {
                if (t.Value.estado1 == temp.estadoInicial)
                {
                    estado = "+" + t.Value.estado1;
                }
                else if (t.Value.estado1 == s)
                {
                    estado = "*" + t.Value.estado1;
                }
                else
                {
                    estado = t.Value.estado1;
                }
            }
            tempEstados1.Add(estado);
            tempSimbolos.Add(t.Value.simbolo);
            foreach (string h in t.Value.estado2)
            {
                string estado2 = "";
                foreach (string s in temp.estadosFinais)
                {
                    if (h == temp.estadoInicial)
                    {
                        estado2 = "+" + h;
                    }
                    else if (h == s)
                    {
                        estado2 = "*" + h;
                    }
                    else if (h == temp.estadoInicial && h == s)
                    {
                        estado2 = "+*" + h;
                    }
                    else
                    {
                        estado2 = h;
                    }
                }
                string[] chave = { estado, t.Value.simbolo, estado2 };
                transicao.Add(chave);
            }
        }
        foreach (string x in tempEstados1)
        {
            estados1.Add(x);
        }
        foreach (string x in tempSimbolos)
        {
            simbolos.Add(x);
        }
        abrirAutomato(estados1, simbolos, transicao);
    }