<commit_before>// ------------------------------------------------------------------------------
//  Copyright (c) 2009-2013 the original author or authors. All Rights Reserved.
//
//  NOTICE: You are permitted to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
// ------------------------------------------------------------------------------

import { interfaces } from "inversify";

import { IConfig } from "../api/IConfig";
import { IContext } from "../api/IContext";
import { IInjector } from "../api/IInjector";
import { ILogger } from "../api/ILogger";
import { IMatcher } from "../api/IMatcher";
import { LifecycleEvent } from "../api/LifecycleEvent";

import { ObjectProcessor } from "./ObjectProcessor";

/**
 * The config manager handles configuration files and
 * allows the installation of custom configuration handlers.
 *
 * <p>It is pre-configured to handle plain objects and classes</p>
 *
 * @private
 */
export class ConfigManager {

    /*============================================================================*/
    /* Private Properties                                                         */
    /*============================================================================*/

    private _objectProcessor: ObjectProcessor = new ObjectProcessor();

    private _configs: Map<any, boolean> = new Map<any, boolean>();

    private _queue: any[] = [];

    private _injector: IInjector;

    private _logger: ILogger;

    private _initialized: boolean = false;

    private _context: IContext;

    /*============================================================================*/
    /* Constructor                                                                */
    /*============================================================================*/

    /**
     * @private
     */
    constructor(context: IContext) {
        this._context = context;
        this._injector = context.injector;
        this._logger = context.getLogger(this);
        this.addConfigHandler(new ClassMatcher(), this.handleClass.bind(this));
        this.addConfigHandler(new ObjectMatcher(), this.handleObject.bind(this));
        // The ConfigManager should process the config queue
        // at the end of the INITIALIZE phase,
        // but *before* POST_INITIALIZE, so use low event priority
        context.addEventListener(LifecycleEvent.INITIALIZE, this.initialize.bind(this)); // , false, -100
    }

    /*============================================================================*/
    /* Public Functions                                                           */
    /*============================================================================*/

    /**<commit_msg>Solving low priority of LifecycleEvent.INITIALIZE on ConfigManager class.<commit_after>// ------------------------------------------------------------------------------
//  Copyright (c) 2009-2013 the original author or authors. All Rights Reserved.
//
//  NOTICE: You are permitted to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
// ------------------------------------------------------------------------------

import { interfaces } from "inversify";

import { IConfig } from "../api/IConfig";
import { IContext } from "../api/IContext";
import { IInjector } from "../api/IInjector";
import { ILogger } from "../api/ILogger";
import { IMatcher } from "../api/IMatcher";
import { LifecycleEvent } from "../api/LifecycleEvent";

import { ObjectProcessor } from "./ObjectProcessor";

/**
 * The config manager handles configuration files and
 * allows the installation of custom configuration handlers.
 *
 * <p>It is pre-configured to handle plain objects and classes</p>
 *
 * @private
 */
export class ConfigManager {

    /*============================================================================*/
    /* Private Properties                                                         */
    /*============================================================================*/

    private _objectProcessor: ObjectProcessor = new ObjectProcessor();

    private _configs: Map<any, boolean> = new Map<any, boolean>();

    private _queue: any[] = [];

    private _injector: IInjector;

    private _logger: ILogger;

    private _initialized: boolean = false;

    private _context: IContext;

    /*============================================================================*/
    /* Constructor                                                                */
    /*============================================================================*/

    /**
     * @private
     */
    constructor(context: IContext) {
        this._context = context;
        this._injector = context.injector;
        this._logger = context.getLogger(this);
        this.addConfigHandler(new ClassMatcher(), this.handleClass.bind(this));
        this.addConfigHandler(new ObjectMatcher(), this.handleObject.bind(this));
        // The ConfigManager should process the config queue
        // at the end of the INITIALIZE phase,
        // but *before* POST_INITIALIZE, so use low event priority
        context.addEventListener(LifecycleEvent.INITIALIZE, this.initialize, this, false, -100);
    }

    /*============================================================================*/
    /* Public Functions                                                           */
    /*============================================================================*/

    /**
{'fraction_non_alphanumeric': 0.30973292704785804, 'fraction_numerical': 0.00394335902491486, 'mean_word_length': 2.301775147928994, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5521972', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1116, 'n_words': 342}