<commit_before>//Dependencies.
var CoreStore = require('../CoreStore');
var getDefinition = require('./definition');

/**
 * Class standing for the cartridge store.
 */
class ApplicationStore extends CoreStore {
  constructor(conf){
    conf = conf || {};
    conf.definition = conf.definition || getDefinition();
    super(conf);
  }

}

module.exports = ApplicationStore;
<commit_msg>[application-store] Add a custom updateMode method.<commit_after>//Dependencies.
var CoreStore = require('../CoreStore');
var getDefinition = require('./definition');
var Immutable = require('immutable');
/**
 * Class standing for the cartridge store.
 */
class ApplicationStore extends CoreStore {
  constructor(conf){
    conf = conf || {};
    conf.definition = conf.definition || getDefinition();
    super(conf);
  }
  /**
   * Update the mode value.
   * @param  {object} dataNode - The value of the data.
   */
  updateMode(dataNode){
    var modeData = this.data.has('mode') ? this.data.get('mode') : Immutable.fromJS({});
    var newModeValue  = modeData.has(dataNode.newMode)? (modeData.get(dataNode.newMode) + 1) : 1;
    //Add a check to not have a negative mode, but it should not happen.
    var previousModeValue =  modeData.has(dataNode.previousMode)? (modeData.get(dataNode.previousMode) - 1) : 0;
    this.data = this.data.set('mode',
      modeData.set(dataNode.newMode, newModeValue).set(dataNode.previousMode, previousModeValue)
    );
    this.willEmit('mode:change');
  }
}

module.exports = ApplicationStore;

{'fraction_non_alphanumeric': 0.14549045424621462, 'fraction_numerical': 0.0026333113890717576, 'mean_word_length': 3.9190938511326863, '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': '2730879', 'n_tokens_mistral': 455, 'n_tokens_neox': 445, 'n_words': 110}