Home directory for Malawi's wwwroot
Duncan Ewan
2021-02-19 3e758c29e0fde36fc088efcfc88f9a3014432b64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
 * @author Ryan
 */
function HashMap(){
    this.map = {};
    this.length = 0;
};
 
HashMap.prototype.exist = function(key){
    return typeof this.map[key] != "undefined";
};
 
HashMap.prototype.put = function(key, val){
    if(!this.exist(key)){
        this.length++;
    }
    this.map[key] = val;
};
 
HashMap.prototype.get = function(key){
    if(this.exist(key)){
        return this.map[key];
    }
 
    return null;
};
 
HashMap.prototype.remove = function(key){
    if(this.exist(key)){
        this.length--;
        delete this.map[key];
    }
};
 
HashMap.prototype.clear = function(){
    this.map = {};
    this.length = 0;
};
 
HashMap.prototype.size = function(){
    return this.length;
};
 
HashMap.prototype.keySet = function(){
    var keys = new Array();
    for(var key in this.map){
        keys.push(key);
    }
 
    return keys;
};
 
HashMap.prototype.valSet = function(){
    var vals = new Array();
    for(var key in this.map){
        vals.push(this.map[key]);
    }
 
    return vals;
};
 
HashMap.prototype.showMe = function(){
    var sb = "";
    for(var key in this.map){
        sb = sb + " [" + key + "]=" + this.map[key];
    }
 
    return sb;
};