<commit_before>package be.kuleuven.cs.distrinet.chameleon.core.namespace;

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

import be.kuleuven.cs.distrinet.chameleon.core.declaration.Declaration;
import be.kuleuven.cs.distrinet.chameleon.core.declaration.SimpleNameSignature;
import be.kuleuven.cs.distrinet.chameleon.core.element.Element;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.LookupContext;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.LookupException;
import be.kuleuven.cs.distrinet.chameleon.core.namespacedeclaration.NamespaceDeclaration;
import be.kuleuven.cs.distrinet.chameleon.core.scope.Scope;
import be.kuleuven.cs.distrinet.chameleon.core.scope.UniversalScope;
import be.kuleuven.cs.distrinet.chameleon.core.validation.Valid;
import be.kuleuven.cs.distrinet.chameleon.core.validation.Verification;
import be.kuleuven.cs.distrinet.chameleon.util.association.Multi;
import be.kuleuven.cs.distrinet.rejuse.association.Association;

public class RegularNamespace extends NamespaceImpl {
	
	public RegularNamespace(String name) {
		this(new SimpleNameSignature(name));
	}
	
	public RegularNamespace(SimpleNameSignature sig) {
		super(sig);
	}

	protected RegularNamespace() {
	}
	/**
	 * SUBNAMESPACES
	 */
	private Multi<Namespace> _namespaces = new Multi<Namespace>(this,"namespaces") {
		@Override
		protected void fireElementAdded(Namespace addedElement) {
			super.fireElementAdded(addedElement);
			registerNamespace(addedElement);
		}
		
		protected void fireElementRemoved(Namespace addedElement) {
			super.fireElementRemoved(addedElement);
			unregisterNamespace(addedElement);
		};
		
		protected void fireElementReplaced(Namespace oldElement, Namespace newElement) {
			super.fireElementReplaced(oldElement, newElement);
			fireElementAdded(newElement);
			fireElementRemoved(oldElement);
		};
	};
	{
		_namespaces.enableCache();
	}

	protected synchronized void addNamespace(Namespace namespace) {
		add(_namespaces,namespace);
		updateCacheNamespaceAdded(namespace);
	}
	
	protected void updateCacheNamespaceAdded(Namespace namespace) {
		flushLocalCache();
	}

	/**
	 * Return all subpackages of this package.
	 */
	public List<Namespace> getSubNamespaces() {
		return _namespaces.getOtherEnds();
	}


	
	/*******************
	 * NAMESPACE PARTS *
	 *******************/

	private Multi<NamespaceDeclaration> _namespaceParts = new Multi<NamespaceDeclaration>(this,"namespace parts");
	{
		_namespaceParts.enableCache();
	}

	public synchronized void addNamespacePart(NamespaceDeclaration namespacePart){
		_namespaceParts.add((Association)namespacePart.namespaceLink());
		flushLocalCache();
	}

	public List<NamespaceDeclaration> getNamespaceParts(){
		return _namespaceParts.getOtherEnds();<commit_msg>renamed a field<commit_after>package be.kuleuven.cs.distrinet.chameleon.core.namespace;

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

import be.kuleuven.cs.distrinet.chameleon.core.declaration.Declaration;
import be.kuleuven.cs.distrinet.chameleon.core.declaration.SimpleNameSignature;
import be.kuleuven.cs.distrinet.chameleon.core.element.Element;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.LookupContext;
import be.kuleuven.cs.distrinet.chameleon.core.lookup.LookupException;
import be.kuleuven.cs.distrinet.chameleon.core.namespacedeclaration.NamespaceDeclaration;
import be.kuleuven.cs.distrinet.chameleon.core.scope.Scope;
import be.kuleuven.cs.distrinet.chameleon.core.scope.UniversalScope;
import be.kuleuven.cs.distrinet.chameleon.core.validation.Valid;
import be.kuleuven.cs.distrinet.chameleon.core.validation.Verification;
import be.kuleuven.cs.distrinet.chameleon.util.association.Multi;
import be.kuleuven.cs.distrinet.rejuse.association.Association;

public class RegularNamespace extends NamespaceImpl {
	
	public RegularNamespace(String name) {
		this(new SimpleNameSignature(name));
	}
	
	public RegularNamespace(SimpleNameSignature sig) {
		super(sig);
	}

	protected RegularNamespace() {
	}
	/**
	 * SUBNAMESPACES
	 */
	private Multi<Namespace> _namespaces = new Multi<Namespace>(this,"namespaces") {
		@Override
		protected void fireElementAdded(Namespace addedElement) {
			super.fireElementAdded(addedElement);
			registerNamespace(addedElement);
		}
		
		protected void fireElementRemoved(Namespace addedElement) {
			super.fireElementRemoved(addedElement);
			unregisterNamespace(addedElement);
		};
		
		protected void fireElementReplaced(Namespace oldElement, Namespace newElement) {
			super.fireElementReplaced(oldElement, newElement);
			fireElementAdded(newElement);
			fireElementRemoved(oldElement);
		};
	};
	{
		_namespaces.enableCache();
	}

	protected synchronized void addNamespace(Namespace namespace) {
		add(_namespaces,namespace);
		updateCacheNamespaceAdded(namespace);
	}
	
	protected void updateCacheNamespaceAdded(Namespace namespace) {
		flushLocalCache();
	}

	/**
	 * Return all subpackages of this package.
	 */
	public List<Namespace> getSubNamespaces() {
		return _namespaces.getOtherEnds();
	}


	
	/*******************
	 * NAMESPACE PARTS *
	 *******************/

	private Multi<NamespaceDeclaration> _namespaceDeclarations = new Multi<NamespaceDeclaration>(this,"namespace parts");
	{
		_namespaceDeclarations.enableCache();
	}

	public synchronized void addNamespacePart(NamespaceDeclaration namespacePart){
		_namespaceDeclarations.add((Association)namespacePart.namespaceLink());
		flushLocalCache();
	}

	public List<NamespaceDeclaration> getNamespaceParts(){
		return _namespaceDeclarations.getOtherEnds();
{'fraction_non_alphanumeric': 0.11469534050179211, 'fraction_numerical': 0.0, 'mean_word_length': 6.145966709346991, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '6002310', 'n_tokens_mistral': 1840, 'n_tokens_neox': 1713, 'n_words': 245}