<commit_before>/* 
==================================================================================================
  Jasy - JavaScript Tooling Refined
  Copyright 2010-2011 <NAME>
==================================================================================================
*/

(function() {
	var genericToString = function() {
		return "[Class " + this.className + "]";
	};
	
	var checkMixinMemberConflicts = function(include, members, name) {
		var allIncludeKeys = {};
		
		if (!members) {
			members = {};
		}
		
		for (var i=0, l=include.length; i<l; i++) {
			var mixin = include[i];
			var mixinKeys = Object.keys(mixin.prototype);
			
			for(var j=0, jl=mixinKeys.length; j<jl; j++) {
				var field = mixinKeys[j];
				
				if (members.hasOwnProperty(field)) {
					// Private field conflict with including class (must fail, always)
					if (field.substring(0,2) == "__") {
						throw new Error("Included class " + mixin.className + " overwrites private field of class " + name);
					}
					
					// members are allowed to override protected and public fields of any included class
				}
				
				if (allIncludeKeys.hasOwnProperty(field)) {
					// Private field conflict between included classes (must fail, always)
					if (field.substring(0,2) == "__") {
						throw new Error("Included class " + mixin.className + " overwrites private member of other included class " + allIncludeKeys[field].className + " in class " + name);
					}
					
					// If both included classes define this field as a function check whether 
					// the members section has a function as well (which might call both of them).
					if (field in members && members[field] instanceof Function && mixin.prototype[field] instanceof Function && allIncludeKeys[field].prototype[field] instanceof Function) {
						// pass
					} else {
						throw new Error("Included class " + mixin.className + " overwrites member of other included class " + allIncludeKeys[field].className + " in class " + name);
					}
				}
				
				allIncludeKeys[field] = mixin;
			}
		}
	};
	
	var checkMixinPropertyConflicts = function() {};
	var checkMixinEventConflicts = function() {};
	
	
	
	var isClassValue = +new Date;

	
	Core.declare("Class", function(name, config) {
	
		if (Permutation.isSet("debug")) {
			Assert.assertModuleName(name, "Invalid class name!");
			Assert.assertMap(config, "Invalid class configuration in class " + name);
			Assert.assertDefiningAllowedKeysOnly(config, ["construct","events","members","properties","include","implement"], 
				"Invalid clas configuration in class " + name + "! Configuration key %1 is not allowed!");
			
			if ("construct" in config) {
				Assert.assertFunction(config.construct, "Invalid constructor in class " + name + "!");
			}
			
			if ("events" in config) {
				Assert.assertMap(config.events, "Invalid event data in class " + name + "!");
			}
			
			if ("members" in config) {
				Assert.assertMap(config.members, "Invalid member section in class " + name);
			}

			if ("properties" in config) {
				Assert.assertMap(config.properties, "Invalid properties section in class " + name);
			}
			
			if ("include" in config) {
				Assert.assertArray(config.include, "Invalid include list in class " + name);
			}

			if ("implement" in config) {
				Assert.assertArray(config.implement, "Invalid implement list in class " + name);
			}
		}
		
		
		
		// ------------------------------------
		//   CONSTRUCTOR
		// ------------------------------------
		
		var construct = config.construct || function construct(){};
	
		// Store name / type
		construct.className = name;
		construct.displayName = name;
		construct.__isClass = isClassValue;
	
		// Add toString() / valueOf()
		construct.toString = genericToString;
		construct.valueOf = genericToString;

		// Attach to namespace
		Core.declare(name, construct);
		
		// Attach events data
		construct.__events = config.events || {};
		
		// Prototype (stuff attached to all instances)
		var proto = construct.prototype;
	
	
	
		// ------------------------------------
		//   LOCALS
		// ------------------------------------
	
		// Attach members
		var members = config.members;
		if (members) {
			for (var key in members) {
				var entry = proto[key] = members[key];
				if (entry instanceof Function) {
					entry.displayName = name + "." + key;
				}
			}
		}
		
		
		// Add properties
		var properties = construct.__properties = config.properties || {};
		for (var key in properties) {
			jasy.property.Property.add(proto, key, properties[key]);
		}
	
	
	
	
	
		// ------------------------------------
		//   MIXINS
		// ------------------------------------
	
		// Insert other classes (mixin)
		var include = config.include;
		if (include) {
			if (Permutation.isSet("debug")) {
				for (var i=0, l=include.length; i<l; i++) {
					Assert.assertClass(include[i], "Class " + name + " includes invalid mixin " + include[i] + " at position: " + i + "!");
				}
				
				if (include.length > 1) {
					checkMixinMemberConflicts(include, members, name);
					checkMixinPropertyConflicts();
					checkMixinEventConflicts();
				}
			}

			for (var i=0, l=include.length; i<l; i++) {
				var mixinproto = include[i].prototype;
				for (var key in mixinproto) {
					proto[key] = mixinproto[key];
				}
			}
		}
		
		

		// ------------------------------------
		//   INTERFACES
		// ------------------------------------<commit_msg>Improved some wordings in file<commit_after>/* 
==================================================================================================
  Jasy - JavaScript Tooling Refined
  Copyright 2010-2011 <NAME>
==================================================================================================
*/

(function() {
	var genericToString = function() {
		return "[Class " + this.className + "]";
	};
	
	var checkMixinMemberConflicts = function(include, members, name) {
		var allIncludeKeys = {};
		
		if (!members) {
			members = {};
		}
		
		for (var i=0, l=include.length; i<l; i++) {
			var includedClass = include[i];
			var includedMembers = Object.keys(includedClass.prototype);
			
			for(var j=0, jl=includedMembers.length; j<jl; j++) {
				var key = includedMembers[j];
				
				if (members.hasOwnProperty(key)) {
					// Private member conflict with including class (must fail, always)
					if (key.substring(0,2) == "__") {
						throw new Error("Included class " + includedClass.className + " overwrites private member of class " + name);
					}
					
					// members are allowed to override protected and public members of any included class
				}
				
				if (allIncludeKeys.hasOwnProperty(key)) {
					// Private members conflict between included classes (must fail, always)
					if (key.substring(0,2) == "__") {
						throw new Error("Included class " + includedClass.className + " overwrites private member of other included class " + allIncludeKeys[key].className + " in class " + name);
					}
					
					// If both included classes define this key as a function check whether 
					// the members section has a function as well (which might call both of them).
					if (key in members && members[key] instanceof Function && includedClass.prototype[key] instanceof Function && allIncludeKeys[key].prototype[key] instanceof Function) {
						// pass
					} else {
						throw new Error("Included class " + includedClass.className + " overwrites member of other included class " + allIncludeKeys[key].className + " in class " + name);
					}
				}
				
				allIncludeKeys[key] = includedClass;
			}
		}
	};
	
	var checkMixinPropertyConflicts = function() {};
	var checkMixinEventConflicts = function() {};
	
	
	
	var isClassValue = +new Date;

	
	Core.declare("Class", function(name, config) {
	
		if (Permutation.isSet("debug")) {
			Assert.assertModuleName(name, "Invalid class name!");
			Assert.assertMap(config, "Invalid class configuration in class " + name);
			Assert.assertDefiningAllowedKeysOnly(config, ["construct","events","members","properties","include","implement"], 
				"Invalid clas configuration in class " + name + "! Configuration key %1 is not allowed!");
			
			if ("construct" in config) {
				Assert.assertFunction(config.construct, "Invalid constructor in class " + name + "!");
			}
			
			if ("events" in config) {
				Assert.assertMap(config.events, "Invalid event data in class " + name + "!");
			}
			
			if ("members" in config) {
				Assert.assertMap(config.members, "Invalid member section in class " + name);
			}

			if ("properties" in config) {
				Assert.assertMap(config.properties, "Invalid properties section in class " + name);
			}
			
			if ("include" in config) {
				Assert.assertArray(config.include, "Invalid include list in class " + name);
			}

			if ("implement" in config) {
				Assert.assertArray(config.implement, "Invalid implement list in class " + name);
			}
		}
		
		
		
		// ------------------------------------
		//   CONSTRUCTOR
		// ------------------------------------
		
		var construct = config.construct || function construct(){};
	
		// Store name / type
		construct.className = name;
		construct.displayName = name;
		construct.__isClass = isClassValue;
	
		// Add toString() / valueOf()
		construct.toString = genericToString;
		construct.valueOf = genericToString;

		// Attach to namespace
		Core.declare(name, construct);
		
		// Attach events and properties data
		var events = construct.__events = config.events || {};
		var properties = construct.__properties = config.properties || {};
		
		// Prototype (stuff attached to all instances)
		var proto = construct.prototype;
	
	
	
		// ------------------------------------
		//   LOCALS
		// ------------------------------------
	
		// Attach members
		var members = config.members;
		if (members) {
			for (var key in members) {
				var entry = proto[key] = members[key];
				if (entry instanceof Function) {
					entry.displayName = name + "." + key;
				}
			}
		}
		
		
		// Add properties
		var properties = construct.__properties = config.properties || {};
		for (var key in properties) {
			jasy.property.Property.add(proto, key, properties[key]);
		}
	
	
	
	
	
		// ------------------------------------
		//   MIXINS
		// ------------------------------------
	
		// Insert other classes
		var include = config.include;
		if (include) {
			if (Permutation.isSet("debug")) {
				for (var i=0, l=include.length; i<l; i++) {
					Assert.assertClass(include[i], "Class " + name + " includes invalid class " + include[i] + " at position: " + i + "!");
				}
				
				checkMixinMemberConflicts(include, members, name);
				checkMixinPropertyConflicts(include, properties, name);
				checkMixinEventConflicts(include, events, name);
			}

			for (var i=0, l=include.length; i<l; i++) {
				var includedClass = include[i];
				
				var includeProto = includedClass.prototype;
				for (var key in includeProto) {
					proto[key] = includeProto[key];
				}
				
				var includeProperties = includedClass.__properties;
				for (var key in includeProperties) {
					properties[key] = includeProperties[key];
				}

				var includeEvents = includedClass.__events;
				for (var key in includeEvents) {
					events[key] = includeEvents[key];
				}
			}
		}
		
		

		// ------------------------------------
		//   INTERFACES
		// ------------------------------------
{'fraction_non_alphanumeric': 0.20257631904005646, 'fraction_numerical': 0.0030880536439033, 'mean_word_length': 2.5421875, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 6, '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': '2065341', 'n_tokens_mistral': 3844, 'n_tokens_neox': 3041, 'n_words': 847}