<commit_before>(function(cjs) {
	var _ = cjs._;
	var constraint_solver = cjs._constraint_solver;

	cjs.fn = {};

	var Constraint = function() {
		constraint_solver.addObject(this);
		this.literal = false;
		this.set.apply(this, arguments);
	};

	(function(my) {
		my.prototype = cjs.fn;

		var proto = my.prototype;
		proto.nullify = function() {
			constraint_solver.nullify(this);
		};
		proto.nullifyAndEval = function() {
			constraint_solver.nullifyAndEval(this);
		};
		proto.cs_eval = function() {
			if(this.hasOwnProperty("value")) {
				if(this.literal) {
					return this.value;
				} else if(_.isFunction(this.value)){
					return this.value();
				} else {
					return cjs.get(this.value);
				}
			} else {
				return undefined;
			}
		};
		proto.set = function(value, literal) {
			var was_literal = this.literal;
			var old_value = this.value;

			if(arguments.length < 2) {
				this.literal = !_.isFunction(value) && !cjs.is_constraint(value);
			} else {
				this.literal = literal === true;
			}
			this.value = value;

			
			if(was_literal !== this.literal || old_value !== this.value) {
				this.nullify();
			}
		};
		proto.get = function() {
			return constraint_solver.getValue(this);
		};
	}(Constraint));

	var create_constraint = function(getter, literal) {
		var constraint;
		if(arguments.length === 0) {
			constraint = new Constraint(undefined);
		} else if(arguments.length === 1) {
			constraint = new Constraint(getter);
		} else {
			constraint = new Constraint(getter, literal);
		}

		return constraint;
	};

	cjs.define("simple_constraint", create_constraint);


	var is_constraint = function(obj) {
		return obj instanceof Constraint;
	};<commit_msg>Starting to add hooks to link constraints with other frameworks<commit_after>(function(cjs) {
	var _ = cjs._;
	var constraint_solver = cjs._constraint_solver;

	cjs.fn = {};

	var Constraint = function() {
		constraint_solver.addObject(this);
		this.literal = false;
		this.set.apply(this, arguments);
	};

	(function(my) {
		my.prototype = cjs.fn;

		var proto = my.prototype;
		proto.nullify = function() {
			constraint_solver.nullify(this);
		};
		proto.nullifyAndEval = function() {
			constraint_solver.nullifyAndEval(this);
		};
		proto.cs_eval = function() {
			if(this.hasOwnProperty("value")) {
				if(this.literal) {
					return this.value;
				} else if(_.isFunction(this.value)){
					return this.value();
				} else {
					return cjs.get(this.value);
				}
			} else {
				return undefined;
			}
		};
		proto.set = function(value, literal, update_fn) {
			var was_literal = this.literal;
			var old_value = this.value;

			if(arguments.length < 2) {
				this.literal = !_.isFunction(value) && !cjs.is_constraint(value);
			} else {
				this.literal = literal === true;
			}

			this.value = value;

			
			if(was_literal !== this.literal || old_value !== this.value) {
				this.nullify();
			}

			if(_.isFunction(update_fn)) {
				this.update(update_fn);
			}
		};
		proto.get = function() {
			return constraint_solver.getValue(this);
		};
		proto.update = function(arg0) {
			if(arguments.length === 0) {
				this.nullify();
			} else {
				var self = this;
				var do_nullify = function() {
					self.nulllify();
				};
				if(_.isFunction(arg0)) {
					arg0(do_nullify);
				}
			}
			return this;
		};
	}(Constraint));

	var create_constraint = function(arg0, arg1, arg2, arg3) {
		var constraint;
		if(arguments.length === 0) {
			constraint = new Constraint(undefined);
		} else if(arguments.length === 1) {
			constraint = new Constraint(arg0);
		} else {
			if(arguments.length === 2 && _.isBoolean(arg1)) {
				constraint = new Constraint(arg0, arg1);
			} else {
				constraint = new Constraint(arg0, arg1, arg2, arg3);
			}
		}

		return constraint;
	};

	cjs.define("simple_constraint", create_constraint);


	var is_constraint = function(obj) {
		return obj instanceof Constraint;
	};
{'fraction_non_alphanumeric': 0.14706635921086345, 'fraction_numerical': 0.0058929028952088135, 'mean_word_length': 3.243478260869565, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7530465', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1318, 'n_words': 253}