<commit_before>package myGalaxy.model;

import java.util.List;

import myGalaxy.MyGalaxy;
import myGalaxy.VK.VkDataProvider;
import myGalaxy.domain.Edge;
import myGalaxy.domain.Graph;
import myGalaxy.domain.Node;
import myGalaxy.graphing.DataProvider;
import myGalaxy.graphing.GraphBuilder;

import org.springframework.stereotype.Service;

@Service
public class GraphService implements IGraphService {

	@Override
	public List<Node> getNodes() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Node> getNodes(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Edge> getEdges() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Edge> getEdges(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	public Graph buildGraph(String userId, String accessToken) {
		GraphBuilder builder = new GraphBuilder();
		DataProvider provider = new VkDataProvider(accessToken);

		return builder.build(provider, userId);
	}
	
	public Graph asyncBuildGraph(String userId, String accessToken, String id) {
		// TODO: implement start of async graph building
		GraphBuilder builder = new GraphBuilder();
		DataProvider provider = new VkDataProvider(accessToken);
		
		return builder.build(provider, userId);
	}

	public Graph pullGraph(String id) {
		Graph g = new Graph();
		
		Graph graph = MyGalaxy.GRAPH_POOL.get(id);
		if(graph != null) {
			g.addAllEdges(graph.getNewEdges());
			g.addAllNodes(graph.getNewNodes());
		}
		<commit_msg>Fixed graph nodes/edges pulling synchronization<commit_after>package myGalaxy.model;

import java.util.List;

import myGalaxy.MyGalaxy;
import myGalaxy.VK.VkDataProvider;
import myGalaxy.domain.Edge;
import myGalaxy.domain.Graph;
import myGalaxy.domain.Node;
import myGalaxy.graphing.DataProvider;
import myGalaxy.graphing.GraphBuilder;

import org.springframework.stereotype.Service;

@Service
public class GraphService implements IGraphService {

	@Override
	public List<Node> getNodes() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Node> getNodes(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Edge> getEdges() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Edge> getEdges(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	public Graph buildGraph(String userId, String accessToken) {
		GraphBuilder builder = new GraphBuilder();
		DataProvider provider = new VkDataProvider(accessToken);

		return builder.build(provider, userId);
	}
	
	public Graph asyncBuildGraph(String userId, String accessToken, String id) {
		// TODO: implement start of async graph building
		GraphBuilder builder = new GraphBuilder();
		DataProvider provider = new VkDataProvider(accessToken);
		
		return builder.build(provider, userId);
	}

	public Graph pullGraph(String id) {
		Graph g = new Graph();
		
		Graph graph = MyGalaxy.GRAPH_POOL.get(id);
		if(graph != null) {
			synchronized (graph) {
				g.addAllEdges(graph.getNewEdges());
				g.addAllNodes(graph.getNewNodes());
			}
		}
		
{'fraction_non_alphanumeric': 0.09749126706891076, 'fraction_numerical': 0.0, 'mean_word_length': 4.506993006993007, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '667003', 'n_tokens_mistral': 1072, 'n_tokens_neox': 967, 'n_words': 258}