Changeset 57
- Timestamp:
- 04/04/06 21:17:08 (2 years ago)
- Files:
-
- trunk/jsolait/lib/sets.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/jsolait/lib/sets.js
r49 r57 46 46 /** 47 47 The Set class. 48 Items in a class must be Strings, Numbers, Objects that return a unique string representation or 49 Objects implementing a __hash__ method. (All objects created from jsolait classes have a __hash__ function. 48 All Items added to a set must be hashable using jsolait's hash() function. 50 49 **/ 51 50 mod.Set=Class(function(publ, supr){ … … 127 126 @return True if the set is a subset of setObj. False otherwise. 128 127 **/ 129 publ.isSub Set = function(setObj){128 publ.isSubset = function(setObj){ 130 129 for(var n in this.items){ 131 130 if(setObj.contains(this.items[n])==false){ … … 141 140 @return True if the set is a super set of setObj. False otherwise. 142 141 **/ 143 publ.isSuper Set = function(setObj){144 return setObj.isSub Set(this);142 publ.isSuperset = function(setObj){ 143 return setObj.isSubset(this); 145 144 }; 146 145 … … 151 150 **/ 152 151 publ.equals=function(setObj){ 153 return (this.isSub Set(setObj) && setObj.isSubSet(this));152 return (this.isSubset(setObj) && setObj.isSubset(this)); 154 153 }; 155 154 156 155 publ.__eq__=function(setObj){ 157 if(setObj.isSub Set!==undefined){156 if(setObj.isSubset!==undefined){ 158 157 return this.equals(setObj); 159 158 }else{ … … 297 296 }; 298 297 299 publ. toString=function(){298 publ.__str__=function(){ 300 299 var items =[]; 301 300 for(var n in this.items){ … … 305 304 }; 306 305 }); 307 308 306 }); 309 307
