var Map = function(){
this._entrys = new配列();
this.put = function(key, value){
if (key == null || key == 未定義) {
return;
}
varindex = this._getIndex(key);
if (index == -1) {
var エントリ = new Object();
entry.key = キー;
entry.value = 値;
this._entrys[this._entrys.length] = エントリ;
}else{
this._entrys[index].value = 値;
}
};
this.get = function(key){
varindex = this._getIndex(key);
return (index != -1) ? this._entrys[インデックス].value : null;
};
this.remove = function(key){
varindex = this._getIndex(key);
if (index != -1) {
this._entrys.splice(index, 1);
}
};
this.clear = function(){
this._entrys.length = 0;;
};
this.contains = function(key){
varindex = this._getIndex(key);
return (index != -1) ? true : false;
};
this.getCount = function(){
return this._entrys.length;
};
this.getEntrys = function(){
return this._entrys;
};
this._getIndex = function(key){
if (key == null || key == 未定義) {
return -1;
}
var _length = this._entrys.length;
for (var i = 0; i varentry = this._entrys[i];
if (エントリ == null || エントリ == 未定義) {
続行;
}
if (entry.key === key) {//equal
return i;
}
}
return -1;
};
this._toString = function(){
var string = "";
for (var i = 0; i string = this.getEntrys()[i].key "::" this.getEntrys()[i ]。価値;
if(i!=this.getEntrys().length-1){
string = ";";
}
}
文字列を返します。
};
};