/// class PD.EventBusCollection

PD.EventBusCollection = Class.extend({

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

    _collection: null,

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

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

    //===================================
    // PUBLIC METHODS
    //===================================

    add: function (id) {
        if (!(id in this._collection)) {
            this._collection[id] = new PD.EventBus(id);
        }
    },

    contains: function (id) {
        return id in this._collection;
    },

    each: function (fn) {
        for (key in this._collection) {
            if (fn) {
                fn(key, this._collection[key]);
            }
        }
    },

    getById: function (id) {
        var result = null;
        if (id in this._collection) {
            result = this._collection[id];
        }
        return result;
    },

    remove: function (id) {
        if (id in this._collection) {
            delete this._collection[id];
        }
    }

});