diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
commit | e44a7e37b6c7b5961adaffc62b9042b8d442938e (patch) | |
tree | 95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/collections/Set.js | |
parent | a62b9742ee5e28bcec6872d88f50f25b820914f6 (diff) | |
download | semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2 |
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/collections/Set.js')
-rw-r--r-- | includes/js/dojox/collections/Set.js | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/includes/js/dojox/collections/Set.js b/includes/js/dojox/collections/Set.js new file mode 100644 index 0000000..6796c1d --- /dev/null +++ b/includes/js/dojox/collections/Set.js @@ -0,0 +1,89 @@ +if(!dojo._hasResource["dojox.collections.Set"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.collections.Set"] = true; +dojo.provide("dojox.collections.Set"); +dojo.require("dojox.collections.ArrayList"); + +(function(){ + var dxc=dojox.collections; + dxc.Set=new (function(){ + function conv(arr){ + if(arr.constructor==Array){ + return new dojox.collections.ArrayList(arr); // dojox.collections.ArrayList + } + return arr; // dojox.collections.ArrayList + } + this.union = function(/* array */setA, /* array */setB){ + // summary + // Return the union of the two passed sets. + setA=conv(setA); + setB=conv(setB); + var result = new dojox.collections.ArrayList(setA.toArray()); + var e = setB.getIterator(); + while(!e.atEnd()){ + var item=e.get(); + if(!result.contains(item)){ + result.add(item); + } + } + return result; // dojox.collections.ArrayList + }; + this.intersection = function(/* array */setA, /* array */setB){ + // summary + // Return the intersection of the two passed sets. + setA=conv(setA); + setB=conv(setB); + var result = new dojox.collections.ArrayList(); + var e = setB.getIterator(); + while(!e.atEnd()){ + var item=e.get(); + if(setA.contains(item)){ + result.add(item); + } + } + return result; // dojox.collections.ArrayList + }; + this.difference = function(/* array */setA, /* array */setB){ + // summary + // Returns everything in setA that is not in setB. + setA=conv(setA); + setB=conv(setB); + var result = new dojox.collections.ArrayList(); + var e=setA.getIterator(); + while(!e.atEnd()){ + var item=e.get(); + if(!setB.contains(item)){ + result.add(item); + } + } + return result; // dojox.collections.ArrayList + }; + this.isSubSet = function(/* array */setA, /* array */setB) { + // summary + // Returns if set B is a subset of set A. + setA=conv(setA); + setB=conv(setB); + var e = setA.getIterator(); + while(!e.atEnd()){ + if(!setB.contains(e.get())){ + return false; // boolean + } + } + return true; // boolean + }; + this.isSuperSet = function(/* array */setA, /* array */setB){ + // summary + // Returns if set B is a superset of set A. + setA=conv(setA); + setB=conv(setB); + var e = setB.getIterator(); + while(!e.atEnd()){ + if(!setA.contains(e.get())){ + return false; // boolean + } + } + return true; // boolean + }; + })(); +})(); + +} |