remove setOps operation

This commit is contained in:
d98762625 2018-04-09 11:19:05 +01:00
parent adc4f78e99
commit 543dce5721
4 changed files with 0 additions and 107 deletions

View file

@ -1,84 +0,0 @@
import Operation from "../Operation";
import Utils from "../Utils";
/**
*
*/
class SetOp extends Operation {
/**
*
* @param {*} runOp
*/
constructor(runOp) {
super();
this.module = "Default";
this.inputType = "string";
this.outputType = "string";
this.args = [
{
name: "Sample delimiter",
type: "binaryString",
value: "\n\n"
},
{
name: "Item delimiter",
type: "binaryString",
value: ","
},
];
this.runOp = runOp;
}
/**
*
* @param sets
*/
validateSampleNumbers(sets) {
if (!sets || (sets.length !== 2)) {
throw "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?";
}
}
/**
*
* @param {*} input
* @param {*} args
*/
run(input, args) {
[this.sampleDelim, this.itemDelimiter] = args;
const sets = input.split(this.sampleDelim);
try {
this.validateSampleNumbers(sets);
} catch (e) {
return e;
}
const result = this.setOp.apply(this, sets.map(s => s.split(this.itemDelimiter)));
// let result = {
// "Union": this.runUnion,
// "Intersection": this.runIntersect,
// "Set Difference": this.runSetDifference,
// "Symmetric Difference": this.runSymmetricDifference,
// "Cartesian Product": this.runCartesianProduct,
// "Power Set": this.runPowerSet.bind(undefined, itemDelimiter),
// }[operation]
// .apply(this, sets.map(s => s.split(itemDelimiter)));
// Formatting issues due to the nested characteristics of power set.
// if (operation === "Power Set") {
// result = result.map(i => `${i}\n`).join("");
// } else {
// result = result.join(itemDelimiter);
// }
return Utils.escapeHtml(result);
}
}
export default SetOp;

View file

@ -16,7 +16,6 @@ import RawDeflate from "./RawDeflate";
import RawInflate from "./RawInflate";
import SetDifference from "./SetDifference";
import SetIntersection from "./SetIntersection";
import SetOps from "./SetOps";
import SetUnion from "./SetUnion";
import ShowBase64Offsets from "./ShowBase64Offsets";
import SymmetricDifference from "./SymmetricDifference";
@ -40,7 +39,6 @@ export {
RawInflate,
SetDifference,
SetIntersection,
SetOps,
SetUnion,
ShowBase64Offsets,
SymmetricDifference,