Professional Documents
Culture Documents
Estado de aceptacin H
Estado de aceptacin I
////////////////////////////////////////// /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package AutomataImposi;
/**
*
* @author Dave
*/
/*
* To change this license header, choose License Headers in Project Properties.
/**
*
* @author Dave
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Scanner;
///////////////////////////////////////////////////////////////////////////////////Estado A
public void A() {//inicia metodo
while (x < n) {
if (arreglo[x] == '0') {
System.out.println("------>Translacion a Edo. B");
x++;
B();
}
if (arreglo[x] == '1') {
System.out.println("------>Translacion a Edo. C");
x++;
C();
} else {
System.out.println("Error");
System.exit(0);
}
}
}
///////////////////////////////////////////////////////////////////////////////////Estado B
public void B() {//inicia metodov
while ((arreglo[x] == '0') ) {
x++;
System.out.println("<----->Retorna a Edo B");
B();
}
if (arreglo[x] == '1') {
System.out.println("------>Translacion a Edo. D");
x++;
D();
}else {
System.out.println("Error");
System.exit(0);
}
}
///////////////////////////////////////////////////////////////////////////////////Estado C
public void C() {//inicia metodo
while (x < n) {
//System.out.println("Translacion a Edo 1");
while ((arreglo[x] == '1') ) {
x++;
System.out.println("<----->Retorna a Edo C");
C();
}
if (arreglo[x] == '0') {
System.out.println("------>Translacion a Edo. E");
x++;
E();
}
else {
System.out.println("Error");
System.exit(0);
}
}
}
///////////////////////////////////////////////////////////////////////////////////Estado D
public void D() {//inicia metodo
if (arreglo[x] == '0') {
System.out.println("------>Translacion a Edo. F");
x++;
F();
}
if (arreglo[x] == '1'){
System.out.println("------>Translacion a Edo. G");
x++;
G();
}
else {
System.out.println("Error");
System.exit(0);
}
}
///////////////////////////////////////////////////////////////////////////////////Estado E
public void E() {//inicia metodo
if (arreglo[x] == '0') {
System.out.println("------>Translacion a Edo. B");
x++;
B();
}
if (arreglo[x] == '1') {
System.out.println("------>Translacion a Edo. H");
x++;
H();
}
else {
System.out.println("Error");
System.exit(0);
}
}
///////////////////////////////////////////////////////////////////////////////////Estado F
public void F() {//inicia metodo
if (arreglo[x] == '0') {
System.out.println("------>Translacion a Edo. B");
x++;
B();
}
if (arreglo[x] == '1') {
System.out.println("------>Translacion a Edo. I");
x++;
I();
}
else {
System.out.println("Error");
System.exit(0);
}
}
///////////////////////////////////////////////////////////////////////////////////Estado G
public void G() {//inicia metodo
if (arreglo[x] == '0') {
System.out.println("------>Translacion a Edo. E");
x++;
E();
}
if (arreglo[x] == '1') {
System.out.println("------>Translacion a Edo. C");
x++;
C();
}
else {
System.out.println("CADENA ACEPTADA POR EL AFD!!! :D ");
System.exit(0);
}
}
///////////////////////////////////////////////////////////////////////////////////Estado H
public void H() {
if (arreglo[x] == '0') {
System.out.println("------>Translacion a Edo. F");
x++;
F();
}
if (arreglo[x] == '1' ) {
System.out.println("------>Translacion a Edo. G");
x++;
G();
}
else {
System.out.println("CADENA ACEPTADA POR EL AFD!!! :D ");
System.exit(0);
}
}
public void I() {
if (arreglo[x] == '0') {
System.out.println("------>Translacion a Edo. F");
x++;
F();
}
if (arreglo[x] == '1' ) {
System.out.println("------>Translacion a Edo. G");
x++;
G();
}
else {
System.out.println("CADENA ACEPTADA POR EL AFD!!! :D ");
System.exit(0);
}
}
}
///////////////////////////////////////////////////
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package AutomataImposi;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Scanner;
/**
*
* @author Dave
*/
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Realizado por: Alexander Francisco Lopez");
System.out.println("||||||||||||||||||||||||||||||||||||||||||");
System.out.println("===================================
=======");
System.out.println("---Escriba Automata Finito Determinista---");
System.out.println("===================================
=======");
System.out.println("||||||||||||||||||||||||||||||||||||||||||");
System.out.println("::::::::::::::::::::::::::::::::::::::::::");
String aut = sc.next();
Masenredadoquenunck call = new Masenredadoquenunck();
call.rey(aut);
call.A();
}
}
/////////////////////////////////////////////////