<commit_before>"use strict";

angular.module('arethusa.artificialToken').service('artificialToken', [
  'state',
  'configurator',
  'idHandler',
  function(state, configurator, idHandler) {
    var self = this;

    function configure() {
      configurator.getConfAndDelegate('artificialToken', self);
      self.createdTokens = {};
      self.count = 0;
      delete self.mode;
      resetModel();
    }

    configure();

    function resetModel() {
      self.model = new ArtificialToken();
    }

    function ArtificialToken (string, type) {
      var self = this;
      this.string = string;
      this.type   = type || 'elliptic';
      this.artificial = true;
    }

    this.supportedTypes = [
      'elliptic'
    ];


    this.setType = function(type) {
      self.model.type = type;
    };

    this.hasType = function(type) {
      return self.model.type === type;
    };

    this.toggleMode = function(mode) {
      if (self.mode === mode) {
        delete self.mode;
      } else {
        self.mode = mode;
      }
    };

    var count = 0;

    function setString() {
      if (! self.model.string) {
        self.model.string = '[' + count + ']';
        count++;
      }
    }

    this.modelValid = function() {
      return self.model.type && self.model.insertionPoint;
    };

    function idIdentifier(id) {
      return 'a';
    }

    function recountATs() {
      self.count = Object.keys(self.createdTokens).length;
    }

    function addArtificialToken(id, token) {
      self.createdTokens[id] = self.model;
      recountATs();
    }

    this.propagateToState = function() {
      setString();
      var id = self.model.insertionPoint.id;
      var idBefore = idHandler.decrement(id);
      var newId = idBefore + idIdentifier(idBefore);
      self.model.id = newId;
      addArtificialToken(newId, self.model);
      resetModel();
    };


    this.init = function() {
      configure();
    };
  }
]);<commit_msg>Whoops, deleted a line accidentially<commit_after>"use strict";

angular.module('arethusa.artificialToken').service('artificialToken', [
  'state',
  'configurator',
  'idHandler',
  function(state, configurator, idHandler) {
    var self = this;

    function configure() {
      configurator.getConfAndDelegate('artificialToken', self);
      self.createdTokens = {};
      self.count = 0;
      delete self.mode;
      resetModel();
    }

    configure();

    function resetModel() {
      self.model = new ArtificialToken();
    }

    function ArtificialToken (string, type) {
      var self = this;
      this.string = string;
      this.type   = type || 'elliptic';
      this.artificial = true;
    }

    this.supportedTypes = [
      'elliptic'
    ];


    this.setType = function(type) {
      self.model.type = type;
    };

    this.hasType = function(type) {
      return self.model.type === type;
    };

    this.toggleMode = function(mode) {
      if (self.mode === mode) {
        delete self.mode;
      } else {
        self.mode = mode;
      }
    };

    var count = 0;

    function setString() {
      if (! self.model.string) {
        self.model.string = '[' + count + ']';
        count++;
      }
    }

    this.modelValid = function() {
      return self.model.type && self.model.insertionPoint;
    };

    function idIdentifier(id) {
      return 'a';
    }

    function recountATs() {
      self.count = Object.keys(self.createdTokens).length;
    }

    function addArtificialToken(id, token) {
      self.createdTokens[id] = self.model;
      recountATs();
    }

    this.propagateToState = function() {
      setString();
      var id = self.model.insertionPoint.id;
      var idBefore = idHandler.decrement(id);
      var newId = idBefore + idIdentifier(idBefore);
      self.model.id = newId;
      addArtificialToken(newId, self.model);
      state.addToken(self.model, newId);
      resetModel();
    };


    this.init = function() {
      configure();
    };
  }
]);
{'fraction_non_alphanumeric': 0.13748738647830475, 'fraction_numerical': 0.0010090817356205853, 'mean_word_length': 2.236734693877551, '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': '4818426', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1227, 'n_words': 232}