<commit_before>/*
 * 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 br.uff.ic.utility;

import br.uff.ic.utility.graph.ActivityVertex;
import br.uff.ic.utility.graph.AgentVertex;
import br.uff.ic.utility.graph.Vertex;
import edu.uci.ics.jung.graph.Graph;

/**
 *
 * @author Kohwalter
 */
public class GraphUtils {
    public static Object hasAgentVertex(Object v) {
        Object vertex = null;
        if(v instanceof Graph) {
            for(Object ver : ((Graph) v).getVertices()) {
                if(ver instanceof AgentVertex)
                    return ver;
                else if(ver instanceof Graph)
                    hasAgentVertex(ver);
                else if(ver instanceof ActivityVertex)
                    vertex = ver;
            }
        } else
            return v;
        return vertex;
    }
}<commit_msg>Fixed another bug in GraphUtils<commit_after>/*
 * 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 br.uff.ic.utility;

import br.uff.ic.utility.graph.ActivityVertex;
import br.uff.ic.utility.graph.AgentVertex;
import br.uff.ic.utility.graph.EntityVertex;
import br.uff.ic.utility.graph.Vertex;
import edu.uci.ics.jung.graph.Graph;

/**
 *
 * @author Kohwalter
 */
public class GraphUtils {
    public static Object hasAgentVertex(Object v) {
        Object activity = null;
        Object entity = null;
        if(v instanceof Graph) {
            for(Object vertex : ((Graph) v).getVertices()) {
                if(vertex instanceof AgentVertex)
                    return vertex;
                else if(vertex instanceof Graph)
                    return hasAgentVertex(vertex);
                else if(vertex instanceof ActivityVertex)
                    activity = vertex;
                else if (vertex instanceof EntityVertex)
                    entity = vertex;
            }
        } else
            return v;
        if(activity != null)
            return activity;
        else
            return entity;
    }
}
{'fraction_non_alphanumeric': 0.08689839572192513, 'fraction_numerical': 0.0, 'mean_word_length': 2.005354752342704, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4222039', 'n_tokens_mistral': 600, 'n_tokens_neox': 582, 'n_words': 178}