<commit_before>

/**
 * A binding between two elements in the source and the avatar on the heatmap
 * that represents the region between the elements.
 *
 * @param {Object} d1: A jQuery-mapped starting delimiter.
 * @param {Object} d2: A jQuery-mapped ending delimiter.
 * @param {Object} target: A d3-wrapped element from the target container.
 */

var Segment = function(d1, d2, target) {
  this.d1 = d1;
  this.d2 = d2;
  this.target = target;
  this._initTargetEvents();
};


/**
 * Bind cursor events on the target.
 */

Segment.prototype._initTargetEvents = function() {

  var self = this;

  this.target
    .on('mouseenter', function() {
      self.highlight();
    })
    .on('mouseleave', function() {
      self.unhighlight();
    });

};


/**
 * Highlight the target.
 */

Segment.prototype.highlight = function() {
  this.target.classed('highlighted', true);
};


/**
 * Unhighlight the target.
 */

Segment.prototype.unhighlight = function() {
  this.target.classed('highlighted', false);
};


module.exports = Segment;<commit_msg>Refactors Segment to follow the organization of Span.<commit_after>

var _ = require('lodash');


/**
 * A binding between two elements in the source and the avatar on the heatmap
 * that represents the region between the elements.
 *
 * @param {Object} d1: A jQuery-mapped starting delimiter.
 * @param {Object} d2: A jQuery-mapped ending delimiter.
 * @param {Object} target: A d3-wrapped element from the target container.
 */

var Segment = function(d1, d2, target) {
  this.d1 = d1;
  this.d2 = d2;
  this.target = target;
  this._initEvents();
};


/**
 * Bind cursor events on the target.
 */

Segment.prototype._initEvents = function() {

  _.bindAll(this, [
    'highlightTarget',
    'unhighlight'
  ]);

  this.target
    .on('mouseenter', this.highlightTarget)
    .on('mouseleave', this.unhighlight);

};


/**
 * Highlight the target.
 */

Segment.prototype.highlightTarget = function() {

  this.target.classed({
    'highlight': true,
    'highlight-target': true
  });

};


/**
 * Unhighlight the target.
 */

Segment.prototype.unhighlight = function() {

  this.target.classed({
    'highlight': false,
    'highlight-target': false
  });

};


module.exports = Segment;
{'fraction_non_alphanumeric': 0.14177101967799643, 'fraction_numerical': 0.008050089445438283, 'mean_word_length': 3.3436893203883495, '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': '6223004', 'n_tokens_mistral': 742, 'n_tokens_neox': 704, 'n_words': 196}