AppTui.HashTable = function()
{
    this.__construct();
};

AppTui.HashTable.prototype = {
    __construct: function()
    {
        this._hash = new Object();
    },

    set: function(key, value, rewrite)
    {
        if (rewrite !== false)
        {
            this._hash[key] = value;
        }
        else if (this.get(key) != null)
        {
            this._hash[key] = value;
        }
    },

    get: function(key)
    {
        if (typeof this._hash[key] != "undefined")
        {
            return this._hash[key];
        }
        else
        {
            return null;
        }
    },

    remove: function(key)
    {
        delete this._hash[key];
    }
};

AppTui.HashTable.getInstance = function()
{
    if (!this.__instance__)
    {
        this.__instance__ = new AppTui.HashTable();
    };

    return this.__instance__;
};
posted on 2011-12-11 16:23  袁晓平  阅读(199)  评论(0编辑  收藏  举报