!(function () { BI.LinkHashMap = function () { this.array = []; this.map = {}; }; BI.LinkHashMap.prototype = { constructor: BI.LinkHashMap, has: function (key) { if (key in this.map) { return true; } return false; }, add: function (key, value) { if (typeof key === "undefined") { return; } if (key in this.map) { this.map[key] = value; } else { this.array.push(key); this.map[key] = value; } }, remove: function (key) { if (key in this.map) { delete this.map[key]; for (var i = 0; i < this.array.length; i++) { if (this.array[i] == key) { this.array.splice(i, 1); break; } } } }, size: function () { return this.array.length; }, each: function (fn, scope) { var scope = scope || window; var fn = fn || null; if (fn == null || typeof (fn) !== "function") { return; } for (var i = 0; i < this.array.length; i++) { var key = this.array[i]; var value = this.map[key]; var re = fn.call(scope, key, value, i, this.array, this.map); if (re == false) { break; } } }, get: function (key) { return this.map[key]; }, toArray: function () { var array = []; this.each(function (key, value) { array.push(value); }); return array; } }; })();