<commit_before>var ProximityManager = (function() {
    "use strict";

    var _w;
    var _h;
    var _nodes;
    var _nodex;
    var _nodey;
    var _map;
    var _clear;

    function ProximityManager(w, h, div) {
	_w = w;
	_h = h;
	_nodes = div;
	_nodex = _w / _nodes;
	_nodey = _h / _nodes;
	_clear = [];
	_map = new Array(_nodes);
	for (var y = 0; y < _nodes; y++) {
	    _map[y] = new Array(_nodes);
	    for (var x = 0; x < _nodes; x++)
		_map[y][x] = {elms:[], cache:[], cached:false}
	}
    };

    ProximityManager.prototype.addElement = function(elm) {
	var x = parseInt(elm.x / _nodex);
	var y = parseInt(elm.y / _nodey);
	if (x < 0 || x >= _nodes || y < 0 || y >= _nodes)
	    return (false);
	if (!_map[y][x].elms.length)
	    _clear.push(y * _nodes + x);
	_map[y][x].elms.push(elm);
	return (true);
    };

    ProximityManager.prototype.clear = function() {
	for (var i in _clear) {
	    var n = _clear[i];
	    var node = _map[parseInt(n / _nodes)][n % _nodes];
	    node.elms = [];
	    node.cache = [];
	    node.cached = false;
	}
	_clear = [];
    };

    ProximityManager.prototype.query = function(x, y) {
	x = parseInt(x / _nodex);
	y = parseInt(y / _nodey);
	if (x < 0 || x >= _nodes || y < 0 || y >= _nodes)
	    return (false);
	var node = _map[y][x]
	if (!node.cached) {
	    for (var j = -1; j <= 1; j++) {
		for (var i = -1; i <= 1; i++) {
		    if (x + i >= 0 && x + i < _nodes && y + j >= 0 && y + j < _nodes)
			node.cache = node.cache.concat(_map[y + j][x + i].elms);
		}
	    }
	    node.cached = true;
	}
	return (node.cache);
    };

    return (ProximityManager);
})();

var Particle = (function() {
    "use strict";

    function Particle(px, py) {
	this.x = px;
	this.y = py;
	this.vx = 0;
	this.vy = 200;
	this.oldx = px;
	this.oldy = py;
    };

    return (Particle);
})();

function LoadBox_initFountain(box) {
    box._img = box._ctx.createImageData(box._canvas.width, box._canvas.height);
    box._manager = new ProximityManager(box._img.width, box._img.height, box._img.width / 20);
    box._list = [];
    box._color = box._params.color == undefined ? 0x0000FF : box._params.color;<commit_msg>Fix: manager now with getter and non static variables<commit_after>var ProximityManager = (function() {
    "use strict";

    function ProximityManager(w, h, div) {
	this._nodes = div;
	this._nodex = w / this._nodes;
	this._nodey = h / this._nodes;
	this._clear = [];
	this._map = new Array(this._nodes);
	for (var y = 0; y < this._nodes; y++) {
	    this._map[y] = new Array(this._nodes);
	    for (var x = 0; x < this._nodes; x++)
		this._map[y][x] = {elms:[], cache:[], cached:false}
	}
    };

    ProximityManager.prototype.addElement = function(elm) {
	var x = parseInt(elm.x / this._nodex);
	var y = parseInt(elm.y / this._nodey);
	if (x < 0 || x >= this._nodes || y < 0 || y >= this._nodes)
	    return (false);
	if (!this._map[y][x].elms.length)
	    this._clear.push(y * this._nodes + x);
	this._map[y][x].elms.push(elm);
	return (true);
    };

    ProximityManager.prototype.clear = function() {
	for (var i in this._clear) {
	    var n = this._clear[i];
	    var node = this._map[parseInt(n / this._nodes)][n % this._nodes];
	    node.elms = [];
	    node.cache = [];
	    node.cached = false;
	}
	this._clear = [];
    };

    ProximityManager.prototype.get = function(x, y) {
	if (x < 0 || y < 0 || y >= this._nodes || x >= this._nodes)
	    return (false);
	return this._map[y][x];
    };

    ProximityManager.prototype.query = function(x, y) {
	x = parseInt(x / this._nodex);
	y = parseInt(y / this._nodey);
	if (x < 0 || x >= this._nodes || y < 0 || y >= this._nodes)
	    return (false);
	var node = this._map[y][x]
	if (!node.cached) {
	    for (var j = -1; j <= 1; j++) {
		for (var i = -1; i <= 1; i++) {
		    if (x + i >= 0 && x + i < this._nodes && y + j >= 0 && y + j < this._nodes)
			node.cache = node.cache.concat(this._map[y + j][x + i].elms);
		}
	    }
	    node.cached = true;
	}
	return (node.cache);
    };

    return (ProximityManager);
})();

var Particle = (function() {
    "use strict";

    function Particle(px, py) {
	this.x = px;
	this.y = py;
	this.vx = 0;
	this.vy = 200;
	this.oldx = px;
	this.oldy = py;
    };

    return (Particle);
})();

function LoadBox_initFountain(box) {
    box._img = box._ctx.createImageData(box._canvas.width, box._canvas.height);
    box._manager = new ProximityManager(box._img.width, box._img.height, box._img.width / 20);
    box._list = [];
    box._color = box._params.color == undefined ? 0x0000FF : box._params.color;
{'fraction_non_alphanumeric': 0.1867165163844293, 'fraction_numerical': 0.010556410820321091, 'mean_word_length': 2.6384, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 17, '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': '7412619', 'n_tokens_mistral': 1858, 'n_tokens_neox': 1767, 'n_words': 425}