<commit_before>// @require: OpenLayers/Layer.js
// @require: OpenLayers/Util.js
OpenLayers.Layer.Grid = Class.create();
OpenLayers.Layer.Grid.TILE_WIDTH = 256;
OpenLayers.Layer.Grid.TILE_HEIGHT = 256;
OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
    
    // str: url
    url: null,

    // hash: params
    params: null,

    // tileSize: OpenLayers.Size
    tileSize: null,
    
    // grid: Array(Array())
    // this is an array of rows, each row is an array of tiles
    grid: null,

    /**
    * @param {str} name
    * @param {str} url
    * @param {hash} params
    */
    initialize: function(name, url, params) {
        var newArguments = arguments;
        if (arguments.length > 0) {
            newArguments = [name];
        }          
        OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
        this.url = url;
        this.params = params;
        this.tileSize = new OpenLayers.Size(OpenLayers.Layer.Grid.TILE_WIDTH,
                                            OpenLayers.Layer.Grid.TILE_HEIGHT);
    },

    /**
     * 
     */
    destroy: function() {
        this.params = null;
        this.clearGrid();
        this.grid = null;
        OpenLayers.Layer.prototype.destroy.apply(this, arguments); 
    },

    setTileSize: function (size) {
        this.tileSize = size.copyOf();
    },

    /** 
     * moveTo
     * moveTo is a function called whenever the map is moved. All the moving
     * of actual 'tiles' is done by the map, but moveTo's role is to accept
     * a bounds and make sure the data that that bounds requires is pre-loaded.
     * @param {OpenLayers.Bounds}
     */
    moveTo:function(bounds,zoomChanged) {
        if (!this.getVisibility()) {
            if (zoomChanged) {
                this.grid = null;
            }
            return;
        }
        var gridBounds = this.getGridBounds();
        if (!this.grid || zoomChanged) {
            this._initTiles();
        } else if ( bounds.top < gridBounds.bottom ||
                    bounds.bottom > gridBounds.top  ) {
            this._initTiles();
        
        } else {
            var i = 0;
            while (gridBounds.bottom > bounds.bottom) {
               this.insertRow(false); 
            }
            while (gridBounds.left > bounds.left) {
               this.insertColumn(true); 
            }
            while (gridBounds.top < bounds.top) {
               this.insertRow(true); 
            }<commit_msg>Yeah, this didn't work out so well. This is neccesary code, but it doesn't work, and I can't figure out why. Moving out -- will work on this in a sandbox.<commit_after>// @require: OpenLayers/Layer.js
// @require: OpenLayers/Util.js
OpenLayers.Layer.Grid = Class.create();
OpenLayers.Layer.Grid.TILE_WIDTH = 256;
OpenLayers.Layer.Grid.TILE_HEIGHT = 256;
OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
    
    // str: url
    url: null,

    // hash: params
    params: null,

    // tileSize: OpenLayers.Size
    tileSize: null,
    
    // grid: Array(Array())
    // this is an array of rows, each row is an array of tiles
    grid: null,

    /**
    * @param {str} name
    * @param {str} url
    * @param {hash} params
    */
    initialize: function(name, url, params) {
        var newArguments = arguments;
        if (arguments.length > 0) {
            newArguments = [name];
        }          
        OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
        this.url = url;
        this.params = params;
        this.tileSize = new OpenLayers.Size(OpenLayers.Layer.Grid.TILE_WIDTH,
                                            OpenLayers.Layer.Grid.TILE_HEIGHT);
    },

    /**
     * 
     */
    destroy: function() {
        this.params = null;
        this.clearGrid();
        this.grid = null;
        OpenLayers.Layer.prototype.destroy.apply(this, arguments); 
    },

    setTileSize: function (size) {
        this.tileSize = size.copyOf();
    },

    /** 
     * moveTo
     * moveTo is a function called whenever the map is moved. All the moving
     * of actual 'tiles' is done by the map, but moveTo's role is to accept
     * a bounds and make sure the data that that bounds requires is pre-loaded.
     * @param {OpenLayers.Bounds}
     */
    moveTo:function(bounds,zoomChanged) {
        if (!this.getVisibility()) {
            if (zoomChanged) {
                this.grid = null;
            }
            return;
        }
        var gridBounds = this.getGridBounds();
        if (!this.grid || zoomChanged) {
            this._initTiles();
        } else {
            var i = 0;
            while (gridBounds.bottom > bounds.bottom) {
               this.insertRow(false); 
            }
            while (gridBounds.left > bounds.left) {
               this.insertColumn(true); 
            }
            while (gridBounds.top < bounds.top) {
               this.insertRow(true); 
            }
{'fraction_non_alphanumeric': 0.11500503524672709, 'fraction_numerical': 0.0032225579053373615, 'mean_word_length': 1.7330764997248211, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1754890', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1429, 'n_words': 362}