root / trunk / web / dojo / dojox / collections / _base.js @ 10
History | View | Annotate | Download (1.25 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.collections._base"]){ |
||
9 | dojo._hasResource["dojox.collections._base"]=true; |
||
10 | dojo.provide("dojox.collections._base");
|
||
11 | dojox.collections.DictionaryEntry=function(k,v){ |
||
12 | this.key=k;
|
||
13 | this.value=v;
|
||
14 | this.valueOf=function(){ |
||
15 | return this.value; |
||
16 | }; |
||
17 | this.toString=function(){ |
||
18 | return String(this.value); |
||
19 | }; |
||
20 | }; |
||
21 | dojox.collections.Iterator=function(_1){ |
||
22 | var a=_1;
|
||
23 | var _2=0; |
||
24 | this.element=a[_2]||null; |
||
25 | this.atEnd=function(){ |
||
26 | return (_2>=a.length);
|
||
27 | }; |
||
28 | this.get=function(){ |
||
29 | if(this.atEnd()){ |
||
30 | return null; |
||
31 | } |
||
32 | this.element=a[_2++];
|
||
33 | return this.element; |
||
34 | }; |
||
35 | this.map=function(fn,_3){ |
||
36 | return dojo.map(a,fn,_3);
|
||
37 | }; |
||
38 | this.reset=function(){ |
||
39 | _2=0;
|
||
40 | this.element=a[_2];
|
||
41 | }; |
||
42 | }; |
||
43 | dojox.collections.DictionaryIterator=function(_4){ |
||
44 | var a=[];
|
||
45 | var _5={};
|
||
46 | for(var p in _4){ |
||
47 | if(!_5[p]){
|
||
48 | a.push(_4[p]); |
||
49 | } |
||
50 | } |
||
51 | var _6=0; |
||
52 | this.element=a[_6]||null; |
||
53 | this.atEnd=function(){ |
||
54 | return (_6>=a.length);
|
||
55 | }; |
||
56 | this.get=function(){ |
||
57 | if(this.atEnd()){ |
||
58 | return null; |
||
59 | } |
||
60 | this.element=a[_6++];
|
||
61 | return this.element; |
||
62 | }; |
||
63 | this.map=function(fn,_7){ |
||
64 | return dojo.map(a,fn,_7);
|
||
65 | }; |
||
66 | this.reset=function(){ |
||
67 | _6=0;
|
||
68 | this.element=a[_6];
|
||
69 | }; |
||
70 | }; |
||
71 | } |