Skip to content

Commit

Permalink
Remove unused and superceded custom methods from XSet class.
Browse files Browse the repository at this point in the history
  • Loading branch information
martindholmes committed Sep 5, 2024
1 parent 3a00cc1 commit a41be5f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 38 deletions.
2 changes: 1 addition & 1 deletion js/SSResultSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class SSResultSet{
}
let ctxIds = ctx.in;
let ctxSet = new XSet(ctxIds);
let intersection = ctxSet.xIntersection(activeContextIds);
let intersection = ctxSet.intersection(activeContextIds);
return (intersection.size > 0);
});
// If there are no contexts left, then
Expand Down
2 changes: 1 addition & 1 deletion js/StaticSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ class StaticSearch{
if (xSets.length > 0){
let result = xSets[0];
for (var i=1; i<xSets.length; i++){
result = result.xIntersection(xSets[i]);
result = result.intersection(xSets[i]);
}
result.filtersActive = true;
return result;
Expand Down
39 changes: 3 additions & 36 deletions js/XSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
/** @class XSet
* @extends Set
* @description This class inherits from the Set class but
* adds some key operators which are missing from that class
* in the current version of ECMAScript. Those methods are
* named with a leading x in case a future version of ECMAScript
* adds native versions.
* adds a single property and a convenience function for
* adding items directly from an array.
*/
class XSet extends Set{
/**
Expand All @@ -36,38 +34,7 @@
//between filters-active-but-no-matches-found
//and no-filters-selected.
}
/** @function XSet~xUnion
* @param {!XSet} xSet2 another instance of the XSet class.
* @description this computes the union of the two sets (all
* items appearing in either set) and returns the result as
* another XSet instance.
* @return {!XSet} a new instance of XSet including all items
* from both sets.
*/
xUnion(xSet2){
return new XSet([...this, ...xSet2]);
}
/** @function XSet~xIntersection
* @param {XSet} xSet2 another instance of the XSet class.
* @description this computes the intersection of the two sets
* (items appearing in both sets) and returns the result as
* another XSet instance.
* @return {XSet} a new instance of XSet only the items
* appearing in both sets.
*/
xIntersection(xSet2){
return new XSet([...this].filter(x => xSet2.has(x)));
}
/** @function XSet~xDifference
* @param {XSet} xSet2 another instance of the XSet class.
* @description this computes the set of items which appear
* in this set but not in the parameter set.
* @return {XSet} a new instance of XSet only the items
* which appear in this set but not in xSet2.
*/
xDifference(xSet2){
return new XSet([...this].filter(x => !xSet2.has(x)));
}

/** @function XSet~addArray
* @param {!Array} arr an array of values that are to be added.
* @description this is a convenience function for adding a set of
Expand Down

0 comments on commit a41be5f

Please sign in to comment.