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 閱讀(1300) 評論(0)  編輯  收藏 所屬分類: javascript
          主站蜘蛛池模板: 商城县| 威远县| 扬中市| 盐亭县| 新泰市| 吴忠市| 云阳县| 富裕县| 通许县| 湘西| 扶余县| 贵溪市| 云林县| 武山县| 鄂伦春自治旗| 观塘区| 米林县| 布拖县| 潼南县| 梅州市| 宜宾县| 大田县| 耿马| 梧州市| 遂平县| 怀安县| 阿坝县| 吉林省| 航空| 凤山县| 孟连| 衢州市| 商水县| 隆德县| 克什克腾旗| 遂溪县| 江达县| 兴海县| 宝清县| 建平县| 太白县|