<commit_before>/*globals define, WebGMEGlobal, Backbone, _*/
/*jshint browser: true*/

/**
 * @author rkereskenyi / https://github.com/rkereskenyi
 */

define([
    'jquery',
    'backbone',
    'js/Constants',
    'js/logger',
    'common/util/assert'
], function (_jquery, _backbone, CONSTANTS, Logger, ASSERT) {

    'use strict';

    var _WebGMEState,
        logger,
        WebGMEStateModel = Backbone.Model.extend({
            registerActiveObject: function (objId) {
                objId = objId === 'root' ? '' : objId;
                logger.debug('registerActiveObject, objId: ', objId);
                this.set(CONSTANTS.STATE_ACTIVE_OBJECT, objId);
            },

            getActiveObject: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_OBJECT);
            },

            registerActiveSelection: function (objIdList) {
                ASSERT(_.isArray(objIdList));
                this.set(CONSTANTS.STATE_ACTIVE_SELECTION, objIdList);
            },

            getActiveSelection: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_SELECTION);
            },

            registerActiveAspect: function (aspect) {
                this.set(CONSTANTS.STATE_ACTIVE_ASPECT, aspect);
            },

            getActiveAspect: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_ASPECT);
            },

            registerActiveVisualizer: function (visualizer) {
                this.set(CONSTANTS.STATE_ACTIVE_VISUALIZER, visualizer);
            },

            getActiveVisualizer: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_VISUALIZER);
            },

            registerActiveProjectName: function (projectName) {
                this.set(CONSTANTS.STATE_ACTIVE_PROJECT_NAME, projectName);
            },

            getActiveProjectName: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_PROJECT_NAME);
            },

            registerActiveBranchName: function (branchName) {
                this.set(CONSTANTS.STATE_ACTIVE_BRANCH_NAME, branchName);
            },

            getActiveBranch: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_BRANCH_NAME);
            },

            registerActiveCommit: function (project) {
                this.set(CONSTANTS.STATE_ACTIVE_COMMIT, project);
            },

            getActiveCommit: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_COMMIT);
            },

            getIsInitPhase: function () {
                return this.get(CONSTANTS.STATE_IS_INIT_PHASE);
            },

            setIsInitPhase: function (initPhase) {
                return this.set(CONSTANTS.STATE_IS_INIT_PHASE, initPhase);
            }

        }),
        _initialize = function () {
            //if already initialized, just return
            if (!_WebGMEState) {
                logger = Logger.create('gme:Utils:StateManager', WebGMEGlobal.gmeConfig.client.log);
                _WebGMEState = new WebGMEStateModel();
                _WebGMEState.registerActiveAspect(CONSTANTS.ASPECT_ALL);
                _WebGMEState.on('change', function (model, options) {
                    logger.debug('', model, options);
                });
            }

            return _WebGMEState;
        };


    //return utility functions
    return {
        initialize: _initialize
    };
});<commit_msg>Fix: UI state manager has to provide means to get activeTab<commit_after>/*globals define, WebGMEGlobal, Backbone, _*/
/*jshint browser: true*/

/**
 * @author rkereskenyi / https://github.com/rkereskenyi
 */

define([
    'jquery',
    'backbone',
    'js/Constants',
    'js/logger',
    'common/util/assert'
], function (_jquery, _backbone, CONSTANTS, Logger, ASSERT) {

    'use strict';

    var _WebGMEState,
        logger,
        WebGMEStateModel = Backbone.Model.extend({
            registerActiveObject: function (objId) {
                objId = objId === 'root' ? '' : objId;
                logger.debug('registerActiveObject, objId: ', objId);
                this.set(CONSTANTS.STATE_ACTIVE_OBJECT, objId);
            },

            getActiveObject: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_OBJECT);
            },

            registerActiveSelection: function (objIdList) {
                ASSERT(_.isArray(objIdList));
                this.set(CONSTANTS.STATE_ACTIVE_SELECTION, objIdList);
            },

            getActiveSelection: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_SELECTION);
            },

            registerActiveAspect: function (aspect) {
                this.set(CONSTANTS.STATE_ACTIVE_ASPECT, aspect);
            },

            getActiveAspect: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_ASPECT);
            },

            registerActiveVisualizer: function (visualizer) {
                this.set(CONSTANTS.STATE_ACTIVE_VISUALIZER, visualizer);
            },

            getActiveVisualizer: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_VISUALIZER);
            },

            registerActiveProjectName: function (projectName) {
                this.set(CONSTANTS.STATE_ACTIVE_PROJECT_NAME, projectName);
            },

            getActiveProjectName: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_PROJECT_NAME);
            },

            registerActiveBranchName: function (branchName) {
                this.set(CONSTANTS.STATE_ACTIVE_BRANCH_NAME, branchName);
            },

            getActiveBranch: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_BRANCH_NAME);
            },

            registerActiveCommit: function (project) {
                this.set(CONSTANTS.STATE_ACTIVE_COMMIT, project);
            },

            getActiveCommit: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_COMMIT);
            },

            getIsInitPhase: function () {
                return this.get(CONSTANTS.STATE_IS_INIT_PHASE);
            },

            setIsInitPhase: function (initPhase) {
                return this.set(CONSTANTS.STATE_IS_INIT_PHASE, initPhase);
            },

            getActiveTab: function () {
                return this.get(CONSTANTS.STATE_ACTIVE_TAB);
            }

        }),
        _initialize = function () {
            //if already initialized, just return
            if (!_WebGMEState) {
                logger = Logger.create('gme:Utils:StateManager', WebGMEGlobal.gmeConfig.client.log);
                _WebGMEState = new WebGMEStateModel();
                _WebGMEState.registerActiveAspect(CONSTANTS.ASPECT_ALL);
                _WebGMEState.on('change', function (model, options) {
                    logger.debug('', model, options);
                });
            }

            return _WebGMEState;
        };


    //return utility functions
    return {
        initialize: _initialize
    };
});
{'fraction_non_alphanumeric': 0.10015694107575973, 'fraction_numerical': 0.0, 'mean_word_length': 1.8028788484606157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5546053', 'n_tokens_mistral': 1959, 'n_tokens_neox': 1894, 'n_words': 296}