www.espacioalternativoiscjosh.es... te tkm mi deysit@
   
  ESPACIOALTERNATIVOISCJOSH
  automata en java conversion de un afn a un afd
 

import java.awt.*;
//import hsa.Console;
import java.util.*;

public class AFNaAFD
{
   int  c;
    public static StringTokenizer editor ()
    {
 String aux = "", aux2;
 do
 {
     c.print (">>");
    aux2 = c.readLine ();
     aux += " " + aux2;
 }
 while (aux2.length () >= 1);
 StringTokenizer tokens = new StringTokenizer (aux);
 return tokens;
    }


    public static void llenar (String [] X, StringTokenizer tokens)
    {
 int i = 0;
 while (tokens.hasMoreTokens ())
     X [i++] = (tokens.nextToken ());
    }


    public static void arreglo (String [] X, String s)
    {
 for (int i = 0 ; i < X.length ; i++)
     X [i] = String.valueOf (s.charAt (i));
    }


    public static void main (String [] args)
    {
 StringTokenizer t;
 String q0,Q [], A [], F [], FT [] [], W [];
 boolean v = true;
 c = new Console ();
 c.println ("Inserte el Conjunto Finito De Estados ");
 Q = new String [(t = editor ()).countTokens ()];
 llenar (Q, t);
 c.println ("Inserte El Alfabeto De Simbolos De Entrada() : ");
 A = new String [(t = editor ()).countTokens ()];
 llenar (A, t);
 FT = new String [Q.length] [A.length];
 AFNaAFDApp AF = new AFNaAFDApp (Q, A, FT);
 q0 = AF.estadoIni (c);
 do
 {
     c.println ("Inserte El Conjunto De Estados Finales[F]  ");
     F = new String [(t = editor ()).countTokens ()];
     llenar (F, t);
     v = AF.validarC (F, Q, c);
 }
 while (!v);
 c.print ("<Presione ENTER> Generar Funcion de Transicion de Estados");
 c.readChar ();
 AF.funTrans ();
 AF.mostrarAFN (c, F);
 c.print ("nn<Presione ENTER> Conversion Automata Finito no determinista[AFN] a un Automata Finito Determinista[AFD] ");
 c.readChar ();
 c.clear ();
 q0=AF.conversion (q0);
 AF.mostrarAFD(c,q0,F);

    }
}


 
 
 
 
chemajosh1290@hotmail.com Este sitio web fue creado de forma gratuita con PaginaWebGratis.es. ¿Quieres también tu sitio web propio?
Registrarse gratis