root / trunk / web / dojo / dojox / collections / Set.js @ 11
History | View | Annotate | Download (1.49 KB)
1 |
/*
|
---|---|
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.Set"]){ |
9 |
dojo._hasResource["dojox.collections.Set"]=true; |
10 |
dojo.provide("dojox.collections.Set");
|
11 |
dojo.require("dojox.collections.ArrayList");
|
12 |
(function(){
|
13 |
var _1=dojox.collections;
|
14 |
_1.Set=new (function(){ |
15 |
function _2(_3){ |
16 |
if(_3.constructor==Array){
|
17 |
return new dojox.collections.ArrayList(_3); |
18 |
} |
19 |
return _3;
|
20 |
}; |
21 |
this.union=function(_4,_5){ |
22 |
_4=_2(_4); |
23 |
_5=_2(_5); |
24 |
var _6=new dojox.collections.ArrayList(_4.toArray()); |
25 |
var e=_5.getIterator();
|
26 |
while(!e.atEnd()){
|
27 |
var _7=e.get();
|
28 |
if(!_6.contains(_7)){
|
29 |
_6.add(_7); |
30 |
} |
31 |
} |
32 |
return _6;
|
33 |
}; |
34 |
this.intersection=function(_8,_9){ |
35 |
_8=_2(_8); |
36 |
_9=_2(_9); |
37 |
var _a=new dojox.collections.ArrayList(); |
38 |
var e=_9.getIterator();
|
39 |
while(!e.atEnd()){
|
40 |
var _b=e.get();
|
41 |
if(_8.contains(_b)){
|
42 |
_a.add(_b); |
43 |
} |
44 |
} |
45 |
return _a;
|
46 |
}; |
47 |
this.difference=function(_c,_d){ |
48 |
_c=_2(_c); |
49 |
_d=_2(_d); |
50 |
var _e=new dojox.collections.ArrayList(); |
51 |
var e=_c.getIterator();
|
52 |
while(!e.atEnd()){
|
53 |
var _f=e.get();
|
54 |
if(!_d.contains(_f)){
|
55 |
_e.add(_f); |
56 |
} |
57 |
} |
58 |
return _e;
|
59 |
}; |
60 |
this.isSubSet=function(_10,_11){ |
61 |
_10=_2(_10); |
62 |
_11=_2(_11); |
63 |
var e=_10.getIterator();
|
64 |
while(!e.atEnd()){
|
65 |
if(!_11.contains(e.get())){
|
66 |
return false; |
67 |
} |
68 |
} |
69 |
return true; |
70 |
}; |
71 |
this.isSuperSet=function(_12,_13){ |
72 |
_12=_2(_12); |
73 |
_13=_2(_13); |
74 |
var e=_13.getIterator();
|
75 |
while(!e.atEnd()){
|
76 |
if(!_12.contains(e.get())){
|
77 |
return false; |
78 |
} |
79 |
} |
80 |
return true; |
81 |
}; |
82 |
})(); |
83 |
})(); |
84 |
} |