home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Puzzle / Clusterz / Clusterz.swf / scripts / ENGINE / CORE / OCache.as next >
Encoding:
Text File  |  2008-09-12  |  5.4 KB  |  212 lines

  1. package ENGINE.CORE
  2. {
  3.    import flash.utils.ByteArray;
  4.    
  5.    public dynamic class OCache
  6.    {
  7.        
  8.       
  9.       public function OCache()
  10.       {
  11.          super();
  12.       }
  13.       
  14.       public function Pack() : ByteArray
  15.       {
  16.          var _loc1_:ByteArray = null;
  17.          _loc1_ = new ByteArray();
  18.          _loc1_.writeObject(this);
  19.          _loc1_.compress();
  20.          return _loc1_;
  21.       }
  22.       
  23.       public function AddCategoryArr(param1:String, param2:String) : Array
  24.       {
  25.          var _loc3_:OCache = null;
  26.          _loc3_ = this[param1] == undefined ? AddCategory(param1) : this[param1];
  27.          return _loc3_.AddArr(param2);
  28.       }
  29.       
  30.       public function GetArrItem(param1:String, param2:int) : *
  31.       {
  32.          if(this[param1] == undefined || this[param1][param2] == undefined)
  33.          {
  34.             return null;
  35.          }
  36.          return this[param1][param2];
  37.       }
  38.       
  39.       public function DeleteArrItem(param1:String, param2:int) : void
  40.       {
  41.          if(this[param1] == undefined)
  42.          {
  43.             return;
  44.          }
  45.          this[param1].splice(param2,1);
  46.       }
  47.       
  48.       public function IsCategoryArrItem(param1:String, param2:String, param3:int) : Boolean
  49.       {
  50.          if(this[param1] == undefined)
  51.          {
  52.             return false;
  53.          }
  54.          return this[param1].IsArrItem(param2,param3);
  55.       }
  56.       
  57.       public function GetCategoryItem(param1:String, param2:String) : *
  58.       {
  59.          if(this[param1] == undefined)
  60.          {
  61.             return null;
  62.          }
  63.          return this[param1].GetItem(param2);
  64.       }
  65.       
  66.       public function SetCategoryItem(param1:String, param2:String, param3:*) : void
  67.       {
  68.          if(this[param1] == undefined)
  69.          {
  70.             this[param1] = new OCache();
  71.          }
  72.          this[param1].SetItem(param2,param3);
  73.       }
  74.       
  75.       public function SetCategoryArrItem(param1:String, param2:String, param3:int, param4:*) : void
  76.       {
  77.          if(this[param1] == undefined)
  78.          {
  79.             this[param1] = new OCache();
  80.          }
  81.          this[param1].SetArrItem(param2,param3,param4);
  82.       }
  83.       
  84.       public function IsCategoryItem(param1:String, param2:String) : Boolean
  85.       {
  86.          if(this[param1] == undefined)
  87.          {
  88.             return false;
  89.          }
  90.          return this[param1].IsItem(param2);
  91.       }
  92.       
  93.       public function DeleteCategoryItem(param1:String, param2:String) : void
  94.       {
  95.          if(this[param1] == undefined)
  96.          {
  97.             return;
  98.          }
  99.          this[param1].DeleteItem(param2);
  100.       }
  101.       
  102.       public function AddCategory(param1:String) : OCache
  103.       {
  104.          this[param1] = new OCache();
  105.          return this[param1];
  106.       }
  107.       
  108.       public function GetCategoryArrItem(param1:String, param2:String, param3:int) : *
  109.       {
  110.          if(this[param1] == undefined)
  111.          {
  112.             return null;
  113.          }
  114.          return GetArrItem(param2,param3);
  115.       }
  116.       
  117.       public function GetCategoryNames(param1:String) : Array
  118.       {
  119.          var _loc2_:Array = null;
  120.          var _loc3_:String = null;
  121.          if(this[param1] == undefined)
  122.          {
  123.             return null;
  124.          }
  125.          _loc2_ = new Array();
  126.          for(_loc3_ in this[param1])
  127.          {
  128.             _loc2_.push(_loc3_);
  129.          }
  130.          return !!_loc2_.length ? _loc2_.sort() : null;
  131.       }
  132.       
  133.       public function AddArr(param1:String) : Array
  134.       {
  135.          this[param1] = new Array();
  136.          return this[param1];
  137.       }
  138.       
  139.       public function GetItem(param1:String) : *
  140.       {
  141.          if(this[param1] == undefined)
  142.          {
  143.             return null;
  144.          }
  145.          return this[param1];
  146.       }
  147.       
  148.       public function IsArrItem(param1:String, param2:int) : Boolean
  149.       {
  150.          return this[param1] != undefined && this[param1][param2] != undefined;
  151.       }
  152.       
  153.       public function DeleteCategoryArrItem(param1:String, param2:String, param3:int) : void
  154.       {
  155.          if(this[param1] == undefined)
  156.          {
  157.             return;
  158.          }
  159.          this[param1].DeleteArrItem(param2,param3);
  160.       }
  161.       
  162.       public function Clear() : void
  163.       {
  164.          var _loc1_:String = null;
  165.          for(_loc1_ in this)
  166.          {
  167.             delete this[_loc1_];
  168.          }
  169.       }
  170.       
  171.       public function SetArrItem(param1:String, param2:int, param3:*) : void
  172.       {
  173.          if(this[param1] == undefined)
  174.          {
  175.             this[param1] = new Array();
  176.          }
  177.          this[param1][param2] = param3;
  178.       }
  179.       
  180.       public function SetItem(param1:String, param2:*) : void
  181.       {
  182.          this[param1] = param2;
  183.       }
  184.       
  185.       public function GetNames() : Array
  186.       {
  187.          var _loc1_:Array = null;
  188.          var _loc2_:String = null;
  189.          _loc1_ = new Array();
  190.          for(_loc2_ in this)
  191.          {
  192.             _loc1_.push(_loc2_);
  193.          }
  194.          return !!_loc1_.length ? _loc1_.sort() : null;
  195.       }
  196.       
  197.       public function IsItem(param1:String) : Boolean
  198.       {
  199.          return this[param1] != undefined;
  200.       }
  201.       
  202.       public function DeleteItem(param1:String) : void
  203.       {
  204.          if(this[param1] == undefined)
  205.          {
  206.             return;
  207.          }
  208.          delete this[param1];
  209.       }
  210.    }
  211. }
  212.