<commit_before>package fr.inria.diverse.k3.sle.lib

import org.eclipse.emf.codegen.ecore.genmodel.GenPackage
import org.eclipse.emf.codegen.ecore.genmodel.GenModel

import org.eclipse.emf.ecore.EPackage
import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.emf.ecore.EClass
import org.eclipse.emf.ecore.EcoreFactory
import org.eclipse.emf.ecore.EAttribute
import org.eclipse.emf.ecore.EStructuralFeature
import org.eclipse.emf.ecore.EReference
import org.eclipse.emf.ecore.ENamedElement
import org.eclipse.emf.ecore.EClassifier

import java.util.ArrayList
import java.util.List

class EcoreExtensions
{
	static def findClass(EPackage pkg, String clsName) {
		pkg.EClassifiers.filter(EClass).findFirst[name == clsName]
	}

	static def findClassifier(EPackage pkg, String clsName) {
		pkg.EClassifiers.filter(EClassifier).findFirst[name == clsName]
	}

	static def isInstantiable(EClass cls) {
		!cls.^abstract && !cls.^interface && cls.instanceClass === null
	}

	static def isAbstractable(EClass cls) {
		cls.instanceClass === null && cls.instanceTypeName === null
	}

	static def isAspectSpecific(ENamedElement f) {
		f.EAnnotations.exists[source == "aspect"]
	}

	static def copy(EPackage pkg) {
		pkg.copy(pkg.name, pkg.name, pkg.nsURI)
	}

	static def copy(EPackage pkg, String name) {
		pkg.copy(name, name.toLowerCase, '''http://«name.toLowerCase»/''')
	}

	static def copy(EPackage pkg, String pkgName, String prefix, String uri) {
		val newPkg = EcoreFactory.eINSTANCE.createEPackage => [
			name = pkgName.toLowerCase<commit_msg>k3-sle: Useless filter<commit_after>package fr.inria.diverse.k3.sle.lib

import org.eclipse.emf.codegen.ecore.genmodel.GenPackage
import org.eclipse.emf.codegen.ecore.genmodel.GenModel

import org.eclipse.emf.ecore.EPackage
import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.emf.ecore.EClass
import org.eclipse.emf.ecore.EcoreFactory
import org.eclipse.emf.ecore.EAttribute
import org.eclipse.emf.ecore.EStructuralFeature
import org.eclipse.emf.ecore.EReference
import org.eclipse.emf.ecore.ENamedElement

import java.util.ArrayList
import java.util.List

class EcoreExtensions
{
	static def findClass(EPackage pkg, String clsName) {
		pkg.EClassifiers.filter(EClass).findFirst[name == clsName]
	}

	static def findClassifier(EPackage pkg, String clsName) {
		pkg.EClassifiers.findFirst[name == clsName]
	}

	static def isInstantiable(EClass cls) {
		!cls.^abstract && !cls.^interface && cls.instanceClass === null
	}

	static def isAbstractable(EClass cls) {
		cls.instanceClass === null && cls.instanceTypeName === null
	}

	static def isAspectSpecific(ENamedElement f) {
		f.EAnnotations.exists[source == "aspect"]
	}

	static def copy(EPackage pkg) {
		pkg.copy(pkg.name, pkg.name, pkg.nsURI)
	}

	static def copy(EPackage pkg, String name) {
		pkg.copy(name, name.toLowerCase, '''http://«name.toLowerCase»/''')
	}

	static def copy(EPackage pkg, String pkgName, String prefix, String uri) {
		val newPkg = EcoreFactory.eINSTANCE.createEPackage => [
			name = pkgName.toLowerCase
{'fraction_non_alphanumeric': 0.11932938856015779, 'fraction_numerical': 0.0009861932938856016, 'mean_word_length': 4.9783889980353635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2775921', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1078, 'n_words': 203}