<commit_before>/**
 * Represents a column of pulls
 */
define(['jquery', 'underscore', 'Templates'], function($, _, Templates) {
   /**
    * Constructor
    *
    * @param thePullFilter A PullFilter which will provide the pulls to display in this column.
    * @param theElementFilter An ElementFilter which will be used to transform
    * the displayed elements in this column.
    * @param theSpec The specification for this column.
    */
   var constructor = function(elementFilter, spec) {
      var self = this;

      // The DOM node that holds all the pretty for this column. Remove it, and
      // it is as if this column never existed (sorta).
      var column;

      // The button to uncollapse this column.
      var columnRestore;

      // The part of this column that actually holds pull elements.
      var container;

      // A map from Pull objects to their associated DOM elements in this
      // column. Used to avoid re-rendering pulls
      var pullsToElems = {};

      // Private methods
      
      /**
       * Renders a template with provided data and appends the resulting node
       * to the end of the JQuery object container.
       */
      var renderInto = function(template, data, container) {
         var templateFunction = Templates.get(template);
         var html = templateFunction(data);
         var node = $(html);
         container.append(node);

         return node;
      };

      var renderRestore = function() {
         return renderInto('restore', spec, $(spec.navbar));
      };

      var renderColumn = function() {
         return renderInto('column', spec, $('#' + spec.id + '-container'));
      };

      /**
       * Add element to this column.
       */
      var addElement = function(element) {
         container.append(element);
      };

      /**
       * Creates a DOM node if one does not already exsist. Otherwise, returns
       * the existing DOM node.
       */
      var getDOMNode = function(pull) {
         var elem = pullsToElems[pull.number];
         if (elem) {
            return elem;
         } else {
            return createDOMNode(pull);
         }
      };

      /**
       * Creates a DOM node from the pull and overwrites whatever was currently
       * stored as the DOM node for that pull with the newly-created node.
       * Allows user code to adjust the node through the adjust method hook
       */
      var createDOMNode = function(pull) {
         var html = self.renderPull(pull);<commit_msg>Changes to Column.js per @davidrans request<commit_after>/**
 * Represents a column of pulls
 */
define(['jquery', 'underscore', 'Templates'], function($, _, Templates) {
   /**
    * Constructor
    *
    * @param theElementFilter An ElementFilter which will be used to transform
    * the displayed elements in this column.
    *
    * @param theSpec The specification for this column. This is a JavaScript
    * object which provides information about the name and id of this column
    * and about the page template. It allows this function to be more
    * general-purpose.
    */
   var constructor = function(elementFilter, spec) {
      var self = this;

      // The DOM node that holds all the pretty for this column. Remove it, and
      // it is as if this column never existed (sorta).
      var column;

      // The button to uncollapse this column.
      var columnRestore;

      // The part of this column that actually holds pull elements.
      var container;

      // A map from Pull objects to their associated DOM elements in this
      // column. Used to avoid re-rendering pulls
      var pullsToElems = {};

      // Private methods
      
      /**
       * Renders a template with provided data and appends the resulting node
       * to the end of the JQuery object container.
       */
      var renderInto = function(template, data, container) {
         var templateFunction = Templates.get(template);
         var html = templateFunction(data);
         var node = $(html);
         container.append(node);

         return node;
      };

      /**
       * Renders the button that can be used to restore the column when it is
       * collapsed. Is only called if the button needs to be rendered.
       */
      var renderRestore = function() {
         return renderInto('restore', spec, $(spec.navbar));
      };

      /**
       * Renders this column's basic structure. That does not include the pulls
       * in the column, only the pretty that surrounds them.
       */
      var renderColumn = function() {
         return renderInto('column', spec, $('#' + spec.id + '-container'));
      };

      /**
       * Add element to this column.
       */
      var addElement = function(element) {
         container.append(element);
      };

      /**
       * Creates a DOM node if one does not already exsist. Otherwise, returns
       * the existing DOM node.
       */
      var getDOMNode = function(pull) {
         var elem = pullsToElems[pull.number];
         if (elem) {
            return elem;
         } else {
            return createDOMNode(pull);
         }
      };

      /**
       * Creates a DOM node from the pull and overwrites whatever was currently
       * stored as the DOM node for that pull with the newly-created node.
       * Allows user code to adjust the node through the adjust method hook
       */
      var createDOMNode = function(pull) {
         var html = self.renderPull(pull);
{'fraction_non_alphanumeric': 0.08706786171574904, 'fraction_numerical': 0.0, 'mean_word_length': 2.0753655793025874, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4178764', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1354, 'n_words': 572}