<commit_before>package org.ulasalle.lexical.analizer;

public class Automata {

    private char[] alphabet;
    private int[][] transitions;
    private final int lengthStates = 9;
    private final int lengthTransitions = 83;

    public void build() {
        loadAlphabet();
        //reservamos memoria
        this.transitions = new int[lengthStates][lengthTransitions];
        //cargamos transiciones
        prepareTransitions();
        loadTransitions();
    }
    
    
    public TypeToken getFinalState(int state) {
        switch (state) {
            case 2:
                return TypeToken.STRING_LITERAL;
            case 3:
            case 4:
                return TypeToken.OPERATOR;
            case 8:
                return TypeToken.IDENTIFIER;
            case 7:
                return TypeToken.CONSTANT_INTEGER;
            case 5:
                return TypeToken.DELIMITER;
            default:
                return TypeToken.IS_NOT_FINAL;
        }
    }

    private void prepareTransitions() {
        //iniciamos las matrices en -1 (transitions) y en false (transitionsAccepted)
        for (int i = 0; i < lengthStates; i++) {
            for (int j = 0; j < lengthTransitions; j++) {
                transitions[i][j] = -1;
            }
        }
    }

    public void showTransitions() {
        System.out.print("\t");
        for (int i = 0; i < lengthTransitions; i++) {
            System.out.print(alphabet[i] + "\t");
        }
        for (int i = 0; i < lengthStates; i++) {
            System.out.print("\n" + i + "\t");
            for (int j = 0; j < lengthTransitions; j++) {
                System.out.print(transitions[i][j] + "\t");
            }
        }
        System.out.print("\n");
    }

    private void loadTransitions() {
        // agregamos comillas apertura                                     q0-q1
        transitions[0][82] = 1;
        // agregamos todo excepto comillas                                 q1-q1
        for (int i = 0; i < 82; i++) {
            transitions[1][i] = 1;
        }
        // agregamos comillas cierre                                       q1-q2
        transitions[1][82] = 2;
        // agregamos operadores aritmeticos                                q0-q3
        for (int i = 62; i < 67; i++) {
            transitions[0][i] = 3;
        }
        // agregamos operadores logicos y asignacion                       q0-q4
        for (int i = 67; i < 71; i++) {
            transitions[0][i] = 4;
        }
        //                                                                 q4-q3
        transitions[4][70] = 3;
        // agregamos operadores de coneccion logica                        q0-q6
        for (int i = 71; i < 73; i++) {
            transitions[0][i] = 6;
        }
        //                                                                 q6-q3
        for (int i = 71; i < 73; i++) {
            transitions[6][i] = 3;
        }
        // agregamos identificadores                                       q0-q8
        for (int i = 0; i < 52; i++) {
            transitions[0][i] = 8;<commit_msg>add new transitions<commit_after>package org.ulasalle.lexical.analizer;

public class Automata {

    private char[] alphabet;
    private int[][] transitions;
    private final int lengthStates = 10;
    private final int lengthTransitions = 83;

    public void build() {
        loadAlphabet();
        //reservamos memoria
        this.transitions = new int[lengthStates][lengthTransitions];
        //cargamos transiciones
        prepareTransitions();
        loadTransitions();
    }
    
    
    public TypeToken getFinalState(int state) {
        switch (state) {
            case 2:
                return TypeToken.STRING_LITERAL;
            case 3:
            case 4:
                return TypeToken.OPERATOR;
            case 8:
                return TypeToken.IDENTIFIER;
            case 7:
                return TypeToken.CONSTANT_INTEGER;
            case 5:
                return TypeToken.DELIMITER;
            default:
                return TypeToken.IS_NOT_FINAL;
        }
    }

    private void prepareTransitions() {
        //iniciamos las matrices en -1 (transitions) y en false (transitionsAccepted)
        for (int i = 0; i < lengthStates; i++) {
            for (int j = 0; j < lengthTransitions; j++) {
                transitions[i][j] = -1;
            }
        }
    }

    public void showTransitions() {
        System.out.print("\t");
        for (int i = 0; i < lengthTransitions; i++) {
            System.out.print(alphabet[i] + "\t");
        }
        for (int i = 0; i < lengthStates; i++) {
            System.out.print("\n" + i + "\t");
            for (int j = 0; j < lengthTransitions; j++) {
                System.out.print(transitions[i][j] + "\t");
            }
        }
        System.out.print("\n");
    }

    private void loadTransitions() {
        // agregamos comillas apertura                                     q0-q1
        transitions[0][82] = 1;
        // agregamos todo excepto comillas                                 q1-q1
        for (int i = 0; i < 82; i++) {
            transitions[1][i] = 1;
        }
        // agregamos comillas cierre                                       q1-q2
        transitions[1][82] = 2;
        // agregamos operadores aritmeticos                                q0-q3
        for (int i = 62; i < 67; i++) {
            transitions[0][i] = 3;
        }
        // agregamos operadores logicos y asignacion                       q0-q4
        for (int i = 67; i < 71; i++) {
            transitions[0][i] = 4;
        }
        //                                                                 q4-q3
        transitions[4][70] = 3;
        // agregamos operadores de coneccion logica
        //                                                                 q0-q9
        transitions[0][71] = 9;
        //                                                                 q9-q3
        transitions[9][71] = 3;
        //                                                                 q0-q6
        transitions[0][72] = 6;
        //                                                                 q6-q3
        transitions[6][72] = 3;
        //                                                                 q6-q3
        for (int i = 71; i < 73; i++) {
            transitions[6][i] = 3;
        }
        // agregamos identificadores                                       q0-q8
        for (int i = 0; i < 52; i++) {
            transitions[0][i] = 8;
{'fraction_non_alphanumeric': 0.10565408519023799, 'fraction_numerical': 0.026830377444292862, 'mean_word_length': 1.0605871330418488, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3022633', 'n_tokens_mistral': 1888, 'n_tokens_neox': 1772, 'n_words': 451}