<commit_before>package cipriano.util;

import cipriano.model.Transicao;
import cipriano.util.Enums.EstadoEnum;
import javagraphviz.src.main.java.com.couggi.javagraphviz.*;

import java.util.*;

/**
 * Created by henrique on 26/08/16.
 */
public class GraphvizUtil {
    public static void gerarGrafo(Set<Transicao> transicaoSet) {
        Map<String, Transicao> transicaoMap = new HashMap<>();
        transicaoSet.forEach(transicao -> transicaoMap.put(transicao.toString(), transicao));

        Digraph digraph = new Digraph("G");
        transicaoMap.forEach((s, transicao) -> {
            Node inicio = null;
            if(transicao.getAtual().getEstado().equals(EstadoEnum.INICIAL)){
                //inicio = digraph.addNode("");
            }
            Node de = digraph.addNode(transicao.getAtual().getNome());
            Node para = digraph.addNode(transicao.getProximoEstadoNome());
            Edge edge = digraph.addEdge(de, para);
            edge.attrs().set("label", new Attr(edge.attrs(), "label", transicao.getCaractere()));
            if(inicio != null){
                digraph.addEdge(inicio, de);
            }
        });

        GraphvizEngine engine = new GraphvizEngine(digraph);
        engine.addType("png");
        engine.toFilePath("helloworld.png");
        engine.output();
    }
}<commit_msg>Implementação para graphviz destacar estados finais e iniciais<commit_after>package cipriano.util;

import cipriano.model.Transicao;
import cipriano.util.Enums.EstadoEnum;
import javagraphviz.src.main.java.com.couggi.javagraphviz.*;

import java.util.*;

/**
 * Created by henrique on 26/08/16.
 */
public class GraphvizUtil {
    public static void gerarGrafo(Set<Transicao> transicaoSet) {
        Map<String, Transicao> transicaoMap = new HashMap<>();
        transicaoSet.forEach(transicao -> transicaoMap.put(transicao.toString(), transicao));

        Digraph digraph = new Digraph("G");
        digraph.attr("rankdir").value("LR");
        transicaoMap.forEach((s, transicao) -> {
            Node inicio = null;
            if(transicao.getAtual().getEstado().equals(EstadoEnum.INICIAL) && !digraph.containsNode(new Node("_start_", digraph))){
                inicio = digraph.addNode("_start_");
                inicio.attr("shape").value("none");
            }
            Node de = digraph.addNode(transicao.getAtual().getNome());
            Node para = digraph.addNode(transicao.getProximoEstadoNome());
            Edge edge = digraph.addEdge(de, para);
            edge.attr("label").value(transicao.getCaractere());

            if(transicao.getAtual().getEstado().equals(EstadoEnum.FINAL) || transicao.getAtual().getEstado().equals(EstadoEnum.AMBOS)){
                de.attr("shape").value("doublecircle");
            }
            if(inicio != null){
                digraph.addEdge(inicio, de);
            }
        });

        GraphvizEngine engine = new GraphvizEngine(digraph);
        engine.addType("png");
        engine.toFilePath("helloworld.png");
        engine.output();
    }
}
{'fraction_non_alphanumeric': 0.14055829228243022, 'fraction_numerical': 0.003940886699507389, 'mean_word_length': 2.705596107055961, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5882313', 'n_tokens_mistral': 984, 'n_tokens_neox': 963, 'n_words': 149}