function Buhin(number){\r
// method\r
- function push(name, data){ // void\r
- var temp = new Object();\r
- temp.name = name;\r
- temp.data = data;\r
- this.array.push(temp);\r
+ function set(name, data){ // void\r
+ this.hash[name] = data;\r
}\r
- Buhin.prototype.push = push;\r
+ Buhin.prototype.push = set;\r
+ Buhin.prototype.set = set;\r
\r
function search(name){ // string\r
- for(var i = 0; i < this.array.length; i++){\r
- if(this.array[i].name == name){\r
- return this.array[i].data;\r
- }\r
+ if(this.hash[name]){\r
+ return this.hash[name];\r
}\r
+ return ""; // no data\r
}\r
Buhin.prototype.search = search;\r
\r
// property\r
- this.array = new Array();\r
+ this.hash = {};\r
\r
// initialize\r
// no operation\r