<commit_before>package jp.ac.kyushu.iarch.basefunction.controller;

import org.eclipse.core.resources.IResource;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.graphiti.mm.pictograms.PictogramsPackage;

import behavior.BehaviorPackage;
import umlClass.UmlClassPackage;

/**
 * Graphiti file parser
 * @author hosoai
 */
public class GraphitiModelManager {
	private static ResourceSet resourceSet;
	static {
		resourceSet = new ResourceSetImpl();
		resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
				.put("diagram", new XMIResourceFactoryImpl());
		resourceSet.getPackageRegistry().put(
				"http://eclipse.org/graphiti/mm/pictograms",
				PictogramsPackage.eINSTANCE);
		resourceSet.getPackageRegistry().put("http://umlClass/1.0",
				UmlClassPackage.eINSTANCE);
		resourceSet.getPackageRegistry().put("http://behavior/1.0",
				BehaviorPackage.eINSTANCE);
	}

	public static Resource getGraphitiModel(IResource file) {
		URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
		Resource resource = resourceSet.getResource(uri, true);
		return resource;
	}

	public static Resource createGraphitiModel(IResource file) {
		URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
		Resource resource = resourceSet.createResource(uri);
		return resource;
	}
}<commit_msg>Bugfix: do not keep a ResourceSetImpl instance to load local diagram files.<commit_after>package jp.ac.kyushu.iarch.basefunction.controller;

import org.eclipse.core.resources.IResource;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.graphiti.mm.pictograms.PictogramsPackage;

import behavior.BehaviorPackage;
import umlClass.UmlClassPackage;

/**
 * Graphiti file parser
 * @author hosoai
 */
public class GraphitiModelManager {

	private static ResourceSet createResourceSet() {
		ResourceSet resourceSet = new ResourceSetImpl();
		resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
				.put("diagram", new XMIResourceFactoryImpl());
		resourceSet.getPackageRegistry().put(
				"http://eclipse.org/graphiti/mm/pictograms",
				PictogramsPackage.eINSTANCE);
		resourceSet.getPackageRegistry().put("http://umlClass/1.0",
				UmlClassPackage.eINSTANCE);
		resourceSet.getPackageRegistry().put("http://behavior/1.0",
				BehaviorPackage.eINSTANCE);
		return resourceSet;
	}

	public static Resource getGraphitiModel(IResource file) {
		URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
		Resource resource = createResourceSet().getResource(uri, true);
		return resource;
	}

	public static Resource createGraphitiModel(IResource file) {
		URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
		Resource resource = createResourceSet().createResource(uri);
		return resource;
	}

}
{'fraction_non_alphanumeric': 0.11518324607329843, 'fraction_numerical': 0.0024638127502309825, 'mean_word_length': 5.852320675105485, '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': '836359', 'n_tokens_mistral': 1034, 'n_tokens_neox': 969, 'n_words': 165}