You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
862 B

4 years ago
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class WorkSet {
constructor(workDomain, workNumber, workDivision) {
this.workDomain = workDomain;
this.workNumber = workNumber;
this.workDivision = workDivision;
this.workSize = Math.floor(this.workDomain.length / this.workDivision);
this.workBegin = this.workNumber * this.workSize;
this.workEnd = this.workBegin + this.workSize;
// be sure that we will process all work for odd workSize.
if (this.workNumber === this.workDivision - 1) {
this.workEnd = this.workDomain.length;
}
}
forEach(callback) {
for (let i = this.workBegin; i < this.workEnd; ++i) {
callback(this.workDomain[i], i);
}
}
}
exports.WorkSet = WorkSet;
//# sourceMappingURL=WorkSet.js.map