1 if(!dojo._hasResource["dojox.collections.Set"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.collections.Set"] = true;
3 dojo.provide("dojox.collections.Set");
4 dojo.require("dojox.collections.ArrayList");
7 var dxc=dojox.collections;
8 dxc.Set=new (function(){
10 if(arr.constructor==Array){
11 return new dojox.collections.ArrayList(arr); // dojox.collections.ArrayList
13 return arr; // dojox.collections.ArrayList
15 this.union = function(/* array */setA, /* array */setB){
17 // Return the union of the two passed sets.
20 var result = new dojox.collections.ArrayList(setA.toArray());
21 var e = setB.getIterator();
24 if(!result.contains(item)){
28 return result; // dojox.collections.ArrayList
30 this.intersection = function(/* array */setA, /* array */setB){
32 // Return the intersection of the two passed sets.
35 var result = new dojox.collections.ArrayList();
36 var e = setB.getIterator();
39 if(setA.contains(item)){
43 return result; // dojox.collections.ArrayList
45 this.difference = function(/* array */setA, /* array */setB){
47 // Returns everything in setA that is not in setB.
50 var result = new dojox.collections.ArrayList();
51 var e=setA.getIterator();
54 if(!setB.contains(item)){
58 return result; // dojox.collections.ArrayList
60 this.isSubSet = function(/* array */setA, /* array */setB) {
62 // Returns if set B is a subset of set A.
65 var e = setA.getIterator();
67 if(!setB.contains(e.get())){
68 return false; // boolean
71 return true; // boolean
73 this.isSuperSet = function(/* array */setA, /* array */setB){
75 // Returns if set B is a superset of set A.
78 var e = setB.getIterator();
80 if(!setA.contains(e.get())){
81 return false; // boolean
84 return true; // boolean