<commit_before>/*
 * Copyright (C) 2013 Vanderbilt University, All rights reserved.
 *
 * Author: <NAME>
 */
"use strict";

define(['logManager',
        'js/Utils/GMEConcepts',
        'js/NodePropertyNames',
        'js/Constants'], function (logManager,
                                                                       GMEConcepts,
                                                                       nodePropertyNames,
                                                                       CONSTANTS) {

    var NODE_PROGRESS_CLASS = 'node-progress',
        GME_MODEL_CLASS = "gme-model",
        GME_ATOM_CLASS = "gme-atom",
        GME_ROOT_ICON = "gme-root",
        PROJECT_ROOT_ID = CONSTANTS.PROJECT_ROOT_ID,
        DEFAULT_VISUALIZER = 'ModelEditor',
        STATE_LOADING = 0,
        STATE_LOADED = 1,
        FCO_ID;

    var InheritanceBrowserControl = function (client, treeBrowser) {
        var self = this;

        this._client = client;
        this._treeBrowser = treeBrowser;
        this._treeBrowser._enableNodeRename = false;
        this._logger = logManager.create("InheritanceBrowserControl");

        setTimeout(function () {
            self._initialize();
        }, 250);
    };

    InheritanceBrowserControl.prototype.destroy = function () {
    };

    InheritanceBrowserControl.prototype.reLaunch = function () {
        this._logger.debug('reLaunch from client...');

        //forget the old territory
        if (this._territoryId) {
            this._client.removeUI(this._territoryId);
            this._territoryId = undefined;
        }

        this._treeBrowser.deleteNode(this._nodes[PROJECT_ROOT_ID].treeNode);

        this._initialize();
    };

    InheritanceBrowserControl.prototype._initialize = function () {
        var self = this;

        FCO_ID = GMEConcepts.getFCOId();

        this._selfPatterns = {};
        this._nodes = {};

        if (FCO_ID) {
            var loadingRootTreeNode;

            this._territoryId = this._client.addUI(this, function (events) {
                self._eventCallback(events);
            });

            //add "root" with its children to territory
            //create a new loading node for it in the tree
            loadingRootTreeNode = this._treeBrowser.createNode(null, {   "id": FCO_ID,
                "name": "Initializing tree...",
                "hasChildren" : false,
                "class" :  NODE_PROGRESS_CLASS });

            //store the node's info in the local hashmap
            this._nodes[FCO_ID] = {   "treeNode": loadingRootTreeNode,
                "inheritance" : [],<commit_msg>bugfix<commit_after>/*
 * Copyright (C) 2013 Vanderbilt University, All rights reserved.
 *
 * Author: <NAME>
 */
"use strict";

define(['logManager',
        'js/Utils/GMEConcepts',
        'js/NodePropertyNames',
        'js/Constants'], function (logManager,
                                                                       GMEConcepts,
                                                                       nodePropertyNames,
                                                                       CONSTANTS) {

    var NODE_PROGRESS_CLASS = 'node-progress',
        GME_MODEL_CLASS = "gme-model",
        GME_ATOM_CLASS = "gme-atom",
        GME_ROOT_ICON = "gme-root",
        PROJECT_ROOT_ID = CONSTANTS.PROJECT_ROOT_ID,
        DEFAULT_VISUALIZER = 'ModelEditor',
        STATE_LOADING = 0,
        STATE_LOADED = 1,
        FCO_ID;

    var InheritanceBrowserControl = function (client, treeBrowser) {
        var self = this;

        this._client = client;
        this._treeBrowser = treeBrowser;
        this._treeBrowser._enableNodeRename = false;
        this._logger = logManager.create("InheritanceBrowserControl");

        setTimeout(function () {
            self._initialize();
        }, 250);
    };

    InheritanceBrowserControl.prototype.destroy = function () {
    };

    InheritanceBrowserControl.prototype.reLaunch = function () {
        this._logger.debug('reLaunch from client...');

        //forget the old territory
        if (this._territoryId) {
            this._client.removeUI(this._territoryId);
            this._territoryId = undefined;
        }

        this._treeBrowser.deleteNode(this._nodes[FCO_ID].treeNode);

        this._initialize();
    };

    InheritanceBrowserControl.prototype._initialize = function () {
        var self = this;

        FCO_ID = GMEConcepts.getFCOId();

        this._selfPatterns = {};
        this._nodes = {};

        if (FCO_ID) {
            var loadingRootTreeNode;

            this._territoryId = this._client.addUI(this, function (events) {
                self._eventCallback(events);
            });

            //add "root" with its children to territory
            //create a new loading node for it in the tree
            loadingRootTreeNode = this._treeBrowser.createNode(null, {   "id": FCO_ID,
                "name": "Initializing tree...",
                "hasChildren" : false,
                "class" :  NODE_PROGRESS_CLASS });

            //store the node's info in the local hashmap
            this._nodes[FCO_ID] = {   "treeNode": loadingRootTreeNode,
                "inheritance" : [],
{'fraction_non_alphanumeric': 0.10229885057471265, 'fraction_numerical': 0.0034482758620689655, 'mean_word_length': 1.6981912144702842, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5449266', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1363, 'n_words': 270}