function TablaHash(){
    this.clear = tablahash_clear;
    this.containsKey = tablahash_containsKey;
    this.containsValue = tablahash_containsValue;
    this.get = tablahash_get;
    this.isEmpty = tablahash_isEmpty;
    this.keys = tablahash_keys;
    this.put = tablahash_put;
    this.remove = tablahash_remove;
    this.size = tablahash_size;
    this.toString = tablahash_toString;
    this.values = tablahash_values;
    this.tablahash = new Array();
}

/*=======Private methods for internal use only========*/

function tablahash_clear(){
    this.tablahash = new Array();
}

function tablahash_containsKey(key){
    var exists = false;
    for (var i in this.tablahash) {
        if (i == key && this.tablahash[i] != null) {
            exists = true;
            break;
        }
    }
    return exists;
}

function tablahash_containsValue(value){
    var contains = false;
    if (value != null) {
        for (var i in this.tablahash) {
            if (this.tablahash[i] == value) {
                contains = true;
                break;
            }
        }
    }
    return contains;
}

function tablahash_get(key){
    return this.tablahash[key];
}

function tablahash_isEmpty(){
    return (parseInt(this.size()) == 0) ? true : false;
}

function tablahash_keys(){
    var keys = new Array();
    for (var i in this.tablahash) {
        if (this.tablahash[i] != null) 
            keys.push(i);
    }
    return keys;
}

function tablahash_put(key, value){
    if (key == null || value == null) {
        throw "NullPointerException {" + key + "},{" + value + "}";
    }else{
        this.tablahash[key] = value;
    }
}

function tablahash_remove(key){
    var rtn = this.tablahash[key];
    this.tablahash[key] = null;
    return rtn;
}

function tablahash_size(){
    var size = 0;
    for (var i in this.tablahash) {
        if (this.tablahash[i] != null) 
            size ++;
    }
    return size;
}

function tablahash_toString(){
    var result = "";
    for (var i in this.tablahash)
    {      
        if (this.tablahash[i] != null) 
            result += "{" + i + "},{" + this.tablahash[i] + "}\n";   
    }
    return result;
}

function tablahash_values(){
    var values = new Array();
    for (var i in this.tablahash) {
        if (this.tablahash[i] != null) 
            values.push(this.tablahash[i]);
    }
    return values;
}


