2 import flash.utils.Dictionary;
5 public function Hash() : void {
6 this.h = new Dictionary();
8 public function set(key : String,value : *) : void {
9 this.h["$" + key] = value;
11 public function get(key : String) : * {
12 return this.h["$" + key];
14 public function exists(key : String) : Boolean {
15 return this.h.hasOwnProperty("$" + key);
17 public function remove(key : String) : Boolean {
19 if(!this.h.hasOwnProperty(key)) return false;
23 public function keys() : * {
24 return (function($this:Hash) : * {
27 for(var $k : String in $this.h) $r.push($k.substr(1));
31 public function iterator() : * {
32 return { ref : this.h, it : function($this:Hash) : * {
35 for(var $k : String in $this.h) $r.push($k);
37 }(this).iterator(), hasNext : function() : * {
38 return this.it.hasNext();
39 }, next : function() : * {
40 var i : * = this.it.next();
44 public function toString() : String {
45 var s : StringBuf = new StringBuf();
47 var it : * = this.keys();
49 while( $it.hasNext() ) { var i : String = $it.next();
53 s.add((this.get(i)).toString());
54 if(it.hasNext()) s.add(", ");