/// class PD.Plugins.PluginScriptCollection

PD.Plugins.PluginScriptCollection = Class.extend({

    //===================================
    // FIELDS
    //===================================

    _defaultScript: null,
    _dictionary: null,

    //===================================
    // CONSTRUCTOR
    //===================================

    init: function (options) {
        this._dictionary = {};
    },

    //===================================
    // PROPERTIES
    //===================================

    get_default: function () {
        return this._defaultScript;
    },

    //===================================
    // METHODS
    //===================================

    add: function (key, value) {

        var containsKeys = null;

        if (!this._dictionary.hasOwnProperty(key)) {

            containsKeys = this.containsKeys();

            this._dictionary[key] = value;

            if (!containsKeys) {
                this._defaultScript = value;
            }
            
        }

    },

    remove: function (key) {

        if (this._dictionary[key] != undefined) {
            delete this._dictionary[key];
        }

    },

    get: function (id) {

        var reuslt = null;

        if (this.containsKey(id)) {
            result = this._dictionary[id];
        }

        return result;

    },

    containsKeys: function () {

        var result = false;

        for (key in this._dictionary) {
            if (this._dictionary.hasOwnProperty(key)) {
                result = true;
                break;
            }
        }

        return result;

    },

    containsKey: function (key) {

        var result = false;

        for (key in this._dictionary) {
            if (this._dictionary.hasOwnProperty(key)) {
                result = true;
                break;
            }
        }

        return result;

    }

});