@jaimermxd/logic-gates
Version:
A simple package introducing logic gates
28 lines (27 loc) • 945 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseGate = void 0;
const InvalidInputError_1 = require("../utils/InvalidInputError");
const product_1 = require("../utils/product");
class BaseGate {
constructor(input) {
if (!Array.isArray(input) || !input.every(inp => typeof inp === "boolean")) {
throw new InvalidInputError_1.default("'input' must be an array of boolean values");
}
this.checkInputValidity(input);
this.input = input;
this.output = [];
this.truthTable = product_1.default([false, true], this.input.length);
this.setOutput();
this.setTruthTable();
}
static create(input) {
let gate = new this(input);
return gate;
}
static getTruthTable() { }
setOutput() { }
setTruthTable() { }
checkInputValidity(input) { }
}
exports.BaseGate = BaseGate;