<commit_before>/**
 * Keyboard Handler
 * @constructor
 * @param {string} svgIdentifier - the dom id of the keyboard layout.
 */
var KeyboardHandler = function()
{

}

/**
 * Last event from the keyboard
 */
KeyboardHandler.prototype.ev = undefined;

/**
 * Map of keys assigned to the keyboard
 */
KeyboardHandler.prototype.keyList = {};

/**
 * Currently active key
 */
KeyboardHandler.prototype.currentKey = undefined;

/**
 * Previous active key
 */
KeyboardHandler.prototype.oldKey = undefined;

/**
 * Attach a new key to the keyboard
 * @param {string} svgIdentifier - the dom id of the key.
 * @param {int} keyCode - the code identifier of the key
 * @param {array} values - list of characters associated to the key
 */
KeyboardHandler.prototype.addKey = function(svgIdentifier, keyCode, values)
{
    var key = new KeyHandler(svgIdentifier, keyCode);
    key.setCharacters(values);

    this.keyList[keyCode] = key;
    return this;<commit_msg>Add the defineKeymap method (set keys in batch)<commit_after>/**
 * Keyboard Handler
 * @constructor
 * @param {KeymapHandler} keymap - the mapping to use by the keyboard
 */
var KeyboardHandler = function(keymap)
{
    this.defineKeymap(keymap);
}

/**
 * Last event from the keyboard
 */
KeyboardHandler.prototype.ev = undefined;

/**
 * Map of keys assigned to the keyboard
 */
KeyboardHandler.prototype.keyList = {};

/**
 * Currently active key
 */
KeyboardHandler.prototype.currentKey = undefined;

/**
 * Previous active key
 */
KeyboardHandler.prototype.oldKey = undefined;

/**
 * Arrange the keys on the keyboard from a specific model
 * @param {Object} svgIdentifier - the map of the keyboard.
 */
KeyboardHandler.prototype.defineKeymap = function(keymap)
{
    var self = this;
    var k;
    for (k in keymap) {
        this.keyList[keymap[k]] = new KeyHandler(k, keymap[k]);
    }
}

/**
 * Attach a new key to the keyboard
 * @param {string} svgIdentifier - the dom id of the key.
 * @param {int} keyCode - the code identifier of the key
 * @param {array} values - list of characters associated to the key
 */
KeyboardHandler.prototype.addKey = function(svgIdentifier, keyCode)
{
    var key = new KeyHandler(svgIdentifier, keyCode);
    //key.setCharacters(values);

    this.keyList[keyCode] = key;
    return this;
{'fraction_non_alphanumeric': 0.11466083150984682, 'fraction_numerical': 0.0, 'mean_word_length': 3.6748466257668713, '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': '6507755', 'n_tokens_mistral': 682, 'n_tokens_neox': 684, 'n_words': 221}