<commit_before>package com.nitorcreations;

import com.nitorcreations.domain.DomainObject;
import com.nitorcreations.domain.Edge;
import com.nitorcreations.domain.EdgeType;

import java.util.List;
import java.util.Map;

import static com.nitorcreations.domain.Direction.BI_DIRECTIONAL;
import static com.nitorcreations.domain.Direction.UNI_DIRECTIONAL;
import static com.nitorcreations.domain.EdgeType.resolveEdgeType;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toList;

public class EdgeResolver {

    public static Edge createEdge(Class<?> clazz, Class fieldType, EdgeType type, String name) {
        DomainObject source = new DomainObject(clazz, name);
        DomainObject target = new DomainObject(fieldType);
        return new Edge(source, target, type, UNI_DIRECTIONAL);
    }

    public static List<Edge> mergeBiDirectionals(List<Edge> edges) {
        Map<?, List<Edge>> groupedEdges = edges.stream()
                .collect(groupingBy(EdgeResolver::sameSourceAndTarget));
        return groupedEdges
                .values().stream()
                .map(EdgeResolver::mergeEdges)
                .collect(toList());
    }

    private static UnorderedTuple<?, ?> sameSourceAndTarget(Edge edge) {
        String sourceId = edge.source.packageName + "." + edge.source.className;
        String targetId = edge.target.packageName + "." + edge.target.className;
        return UnorderedTuple.of(sourceId, targetId);
    }<commit_msg>renamed arguments to clarify purpose<commit_after>package com.nitorcreations;

import com.nitorcreations.domain.DomainObject;
import com.nitorcreations.domain.Edge;
import com.nitorcreations.domain.EdgeType;

import java.util.List;
import java.util.Map;

import static com.nitorcreations.domain.Direction.BI_DIRECTIONAL;
import static com.nitorcreations.domain.Direction.UNI_DIRECTIONAL;
import static com.nitorcreations.domain.EdgeType.resolveEdgeType;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toList;

public class EdgeResolver {

    public static Edge createEdge(Class<?> sourceClass, Class<?> field, EdgeType type, String name) {
        DomainObject source = new DomainObject(sourceClass, name);
        DomainObject target = new DomainObject(field);
        return new Edge(source, target, type, UNI_DIRECTIONAL);
    }

    public static List<Edge> mergeBiDirectionals(List<Edge> edges) {
        Map<?, List<Edge>> groupedEdges = edges.stream()
                .collect(groupingBy(EdgeResolver::sameSourceAndTarget));
        return groupedEdges
                .values().stream()
                .map(EdgeResolver::mergeEdges)
                .collect(toList());
    }

    private static UnorderedTuple<?, ?> sameSourceAndTarget(Edge edge) {
        String sourceId = edge.source.packageName + "." + edge.source.className;
        String targetId = edge.target.packageName + "." + edge.target.className;
        return UnorderedTuple.of(sourceId, targetId);
    }
{'fraction_non_alphanumeric': 0.10204755614266843, 'fraction_numerical': 0.0, 'mean_word_length': 3.7700787401574805, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '4262211', 'n_tokens_mistral': 878, 'n_tokens_neox': 848, 'n_words': 178}