Rising Sun

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  148 随笔 :: 0 文章 :: 22 评论 :: 0 Trackbacks
 1 /**
 2  * Project:        
 3  * Author:        zhy
 4  * Company:     
 5  * Created Date:    2007-6-29
 6  * 
 7  * Copyright @ 2007
 8  * 
 9  * History:
10  * ------------------------------------------------------------------------------
11  * Date            |time        |Author    |Change Description        */
12 
13 var Obj = function (key ,value){
14    this.key = key; 
15    this.value = value;
16 };
17 var ha = new Array();
18 var Hash = function (){
19    //this.a =ha;
20 }
21 Hash.prototype.haa = function (){
22     return ha;
23 }
24 Hash.prototype.clear = function (){
25     ha = new Array();
26 }
27 Hash.prototype.clone = function (){
28     return this;
29 }
30 Hash.prototype.get = function (key){
31    
32     for(var i=0;i<ha.length ;i++){
33         if(ha[i].key==key){
34             return ha[i].value;
35         }
36     }
37    
38 }
39 Hash.prototype.put = function (key ,value){
40 
41     if(ha.length !=0){
42        
43          for(var i=0;i<ha.length;i++){
44             if(ha[i].key != key){
45                  ha[ha.length]=new Obj(key ,value);
46             }
47          }    
48     }else{
49          ha[ha.length]=new Obj(key ,value);
50    }
51    
52  
53 }
54 
55 Hash.prototype.size = function (){
56     return ha.length ;
57 }
58 
59 Hash.prototype.remove = function (key){
60       for(var i=0;i<ha.length;i++){
61         if(ha[i].key == key){
62            ha.without(ha[i]);
63         }
64     }
65 

posted on 2007-07-03 14:38 brock 阅读(1284) 评论(0)  编辑  收藏 所属分类: javascript

只有注册用户登录后才能发表评论。


网站导航: