<commit_before>GraphSim = (function(oldModule){

function Controller(graph){
  this.views = [];
  this.graph = graph;
  document.addEventListener("model_added", this.render.bind(this));
  document.addEventListener("model_removed", this.removeView.bind(this));
};

Controller.prototype = {
  createView: function(model){
       var view = new GraphSim.View(model);
       this.views.push(view);
       return view;
  },
  render: function(event){
      var view = this.createView(event.model);
      var shape = view.getShape();
      GraphSim.canvas.addChild(shape);
      if(view.model.type == "edge"){
        shape.zIndex = "back";
      }
    },
    redraw: function(){
      GraphSim.canvas.redraw();
    },

  highlight: function(model){
    var view = _.findWhere(this.views, {model: model});
    view.setHighlight();
    this.redraw();
  },
  removeHighlight: function(model){
    var view = _.findWhere(this.views, {model: model});
    view.removeHighlight();
    this.redraw();
  },
  removeView: function(event){
    var view = _.findWhere(this.views, {model: event.model});
    GraphSim.canvas.removeChild(view.getShape());
    this.views = _.difference(this.views);
    GraphSim.canvas.redraw();
  }


};

oldModule.controller = new Controller(GraphSim.getGraph());

return oldModule;

})(GraphSim);<commit_msg>Added removeAllHighlights method<commit_after>GraphSim = (function(oldModule){

function Controller(graph){
  this.views = [];
  this.graph = graph;
  document.addEventListener("model_added", this.render.bind(this));
  document.addEventListener("model_removed", this.removeView.bind(this));
};

Controller.prototype = {
  createView: function(model){
       var view = new GraphSim.View(model);
       this.views.push(view);
       return view;
  },
  render: function(event){
      var view = this.createView(event.model);
      var shape = view.getShape();
      GraphSim.canvas.addChild(shape);
      if(view.model.type == "edge"){
        shape.zIndex = "back";
      }
    },
    redraw: function(){
      GraphSim.canvas.redraw();
    },

  highlight: function(model){
    var view = _.findWhere(this.views, {model: model});
    view.setHighlight();
    this.redraw();
  },
  removeHighlight: function(model){
    var view = _.findWhere(this.views, {model: model});
    view.removeHighlight();
    this.redraw();
  },
  removeAllHighlights: function(){
    _.each(this.views, function(view){
      if( view.model.type === "vertex"){
      view.removeHighlight();
    }
    });
    this.redraw();
  },
  removeView: function(event){
    var view = _.findWhere(this.views, {model: event.model});
    GraphSim.canvas.removeChild(view.getShape());
    this.views = _.difference(this.views);
    GraphSim.canvas.redraw();
  }


};

oldModule.controller = new Controller(GraphSim.getGraph());

return oldModule;

})(GraphSim);
{'fraction_non_alphanumeric': 0.16035087719298247, 'fraction_numerical': 0.0, 'mean_word_length': 3.496845425867508, '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': '3575103', 'n_tokens_mistral': 894, 'n_tokens_neox': 877, 'n_words': 154}