<commit_before>IRIS.ModifierProvider = Class.extend({
    _modifierIns: {},
    //_entityAsset: {},
    _modifierOpts: {},
    init: function(opts) {
        if (IRIS._isObject(opts)) {
            for(var key in opts) {
                opts[key] = this._normalizeOpts(key, opts[key]);
                //this._registerEntityAssetRel(key,opts[key].entity);
                this._registerModifierOpts(key, opts[key]);
            }
        }
    },
    getModifier: function(id) {
        if (typeof this._modifierIns[id] !== 'undefined')
            return this._modifierIns[id];
        var opts = this.getModifierOpts(id);
        if (opts) {
            switch (opts.target) {
                default:
                    var oModifier = this._getModifier('id', opts);
            }
            /*var oModifier = new IRIS.Modifier({
                            id: id,
                            target: opts.target,
                            zone: opts.zone,
                            zoneOpts: opts.zoneOpts});*/
            this._modifierIns[id] = oModifier;
            return oModifier;
        }
        return false;
    },
    apply: function(oAsset, modifierIds) {
        for(var key in modifierIds) {
            if (!IRIS._isUndef(this._modifierOpts[modifierIds[key]])) {
                //TODO: implement concept of shared and private modifiers
                //IF shared we create an instance of a modifier bound to this provider
                var modifierIns = this._modifierIns[modifierIds[key]];
                if (IRIS._isUndef(modifierIns)) {
                    modifierIns = this._getModifierInstance(this._modifierOpts[modifierIds[key]]);
                    this._modifierIns[modifierIds[key]] = modifierIns;
                }
                if (modifierIns)
                    modifierIns.apply(oAsset);
            }
        }
    },
    getModifierOpts: function(id) {
        if (!IRIS._isUndef(this._modifierOpts[id]))
            return this._modifierOpts[id];
        return false;
    },
    _getModifierInstance: function(opts) {
        switch(opts.target) {
            case IRIS.MODIFIER_TARGET_POSITION:
                return new IRIS.ThreejsPositionModifier(opts);
            default:
                return false;
        }
    },
    _normalizeOpts: function(modifierId, opts) {
        if (typeof opts == 'object') {
            if (typeof opts.id == 'undefined')
                opts.id = modifierId;
        }
        return opts;
    },
    _registerModifierOpts: function(modifierId, opts) {
        this._modifierOpts[modifierId] = opts;
    }
});

IRIS.ctrl.modifierProvider = {};
IRIS.registerModifierProvider = function(modifierProviderClass, id) {
    IRIS.ctrl.modifierProvider[id] = modifierProviderClass;
};
<commit_msg>The provider executes modifiers by using it's id or handling an intance passed as reference.<commit_after>IRIS.ModifierProvider = Class.extend({
    _modifierIns: {},
    //_entityAsset: {},
    _modifierOpts: {},
    init: function(opts) {
        if (IRIS._isObject(opts)) {
            for(var key in opts) {
                opts[key] = this._normalizeOpts(key, opts[key]);
                //this._registerEntityAssetRel(key,opts[key].entity);
                this._registerModifierOpts(key, opts[key]);
            }
        }
    },
    getModifier: function(id) {
        if (typeof this._modifierIns[id] !== 'undefined')
            return this._modifierIns[id];
        var opts = this.getModifierOpts(id);
        if (opts) {
            switch (opts.target) {
                default:
                    var oModifier = this._getModifier('id', opts);
            }
            /*var oModifier = new IRIS.Modifier({
                            id: id,
                            target: opts.target,
                            zone: opts.zone,
                            zoneOpts: opts.zoneOpts});*/
            this._modifierIns[id] = oModifier;
            return oModifier;
        }
        return false;
    },
    apply: function(oAsset, modifierIds) {
        for(var key in modifierIds) {
            if (IRIS._isString(modifierIds[key])) {
                if (!IRIS._isUndef(this._modifierOpts[modifierIds[key]])) {
                    //TODO: implement concept of shared and private modifiers
                    //IF shared we create an instance of a modifier bound to this provider
                    var modifierIns = this._modifierIns[modifierIds[key]];
                    if (IRIS._isUndef(modifierIns)) {
                        modifierIns = this._getModifierInstance(this._modifierOpts[modifierIds[key]]);
                        this._modifierIns[modifierIds[key]] = modifierIns;
                    }
                    if (modifierIns)
                        modifierIns._apply(oAsset);
                }
            } else {
                modifierIds[key].apply(oAsset);
            }
        }
    },
    getModifierOpts: function(id) {
        if (!IRIS._isUndef(this._modifierOpts[id]))
            return this._modifierOpts[id];
        return false;
    },
    _getModifierInstance: function(opts) {
        switch(opts.target) {
            case IRIS.MODIFIER_TARGET_POSITION:
                return new IRIS.ThreejsPositionModifier(opts);
            default:
                return false;
        }
    },
    _normalizeOpts: function(modifierId, opts) {
        if (typeof opts == 'object') {
            if (typeof opts.id == 'undefined')
                opts.id = modifierId;
        }
        return opts;
    },
    _registerModifierOpts: function(modifierId, opts) {
        this._modifierOpts[modifierId] = opts;
    }
});

IRIS.ctrl.modifierProvider = {};
IRIS.registerModifierProvider = function(modifierProviderClass, id) {
    IRIS.ctrl.modifierProvider[id] = modifierProviderClass;
};

{'fraction_non_alphanumeric': 0.10680610320589748, 'fraction_numerical': 0.0, 'mean_word_length': 1.6835326586936523, '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': '5296009', 'n_tokens_mistral': 1613, 'n_tokens_neox': 1617, 'n_words': 306}