custom-permutation 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,187 +1,102 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PermutationGeneratorForSet = void 0;
4
- var Utils_1 = require("./Utils");
5
- var PermutationGeneratorForSet = /** @class */ (function () {
6
- function PermutationGeneratorForSet(elementList, set, // set of index
7
- choicesByIndex, indexesOfSameElements, actualOrderOfElements, passFunction, randomizeChoices) {
4
+ class PermutationGeneratorForSet {
5
+ constructor(elementList, indexList, choicesByIndex, indexesOfSameElements, actualOrderOfElements, passFunction) {
8
6
  this.elementList = elementList;
9
- this.set = set;
7
+ this.indexList = indexList;
10
8
  this.choicesByIndex = choicesByIndex;
11
9
  this.indexesOfSameElements = indexesOfSameElements;
12
10
  this.actualOrderOfElements = actualOrderOfElements;
13
11
  this.passFunction = passFunction;
14
- this.randomizeChoices = randomizeChoices;
15
12
  this.choicesArraysInitial = []; // possible choices for each element for requested permutations
16
13
  this.choicesArrays = []; // possible choices for each element for requested permutations
17
- this.numOfEl = 0;
14
+ this.size = 0;
18
15
  this.currentIndsOfChoices = []; // indice array of current perm to compose
19
16
  this.currentElInd = 0; // indice of current elemet to add in perm list
20
- this.newPerm = []; // list for new permutation
21
- this.initialSet = []; // original set for new permutation
22
- this.listIndexesAfterArrangement = [];
23
- this.actualAndPrevIndexesInPermAfterSortedByChoicesLength = {};
24
- this.elIsUsedDict = {}; // keeps the usage status of each set index as key
25
- // Which defines the actual orders of these elements, used as timeSlot
26
- // default orders are sequental, but in usage, they can be seperate from each other
27
- this.actualOrderOfElements = this.actualOrderOfElements || Array(set.length).fill(1).map(function (el, i) { return i; });
28
- // indexesofsameelements is position of every element by default
29
- this.indexesOfSameElements = this.indexesOfSameElements || Array(set.length).fill(1).map(function (el, i) { return i; });
30
- if (!this.validateParameters(set, choicesByIndex)) {
17
+ this.newPerm = [];
18
+ this.initialIndexList = []; // original set for new permutation
19
+ this.visitedDict = {};
20
+ this.actualOrderOfElements =
21
+ this.actualOrderOfElements ||
22
+ Array(indexList.length)
23
+ .fill(1)
24
+ .map((el, i) => i);
25
+ this.indexesOfSameElements =
26
+ this.indexesOfSameElements ||
27
+ Array(indexList.length)
28
+ .fill(1)
29
+ .map((el, i) => i);
30
+ if (!this.validateParameters(indexList, choicesByIndex)) {
31
31
  return;
32
32
  }
33
- this.initialSet = set;
34
- set = set.reduce(function (init, el, i) { return set.indexOf(el) == i ? init.concat(el) : init; }, []); // be sure for it to be set
35
- this.numOfEl = set.length;
33
+ indexList = Array.from(new Set(indexList));
34
+ this.initialIndexList = indexList;
35
+ this.size = indexList.length;
36
36
  this.initChoicesArray();
37
37
  this.reorderListAndChoicesAccordingToChoicesCount();
38
- this.initPrevIndexes();
39
- this.currentIndsOfChoices[this.numOfEl - 1] = -1; // make last element as to be next
38
+ this.currentIndsOfChoices[this.size - 1] = -1;
40
39
  this.init();
41
40
  }
42
- PermutationGeneratorForSet.prototype.initPrevIndexes = function () {
43
- var keys = Object.keys(this.indexesAndChoicesArrayLengthsSortedByLength);
44
- var _loop_1 = function (permInd) {
45
- var elIndInPerm = this_1.indexesAndChoicesArrayLengthsSortedByLength[permInd].index;
46
- var prevElIndInPerm = this_1.indexesAndChoicesArrayLengthsSortedByLength.findIndex(function (x) { return x.index == elIndInPerm - 1; });
47
- var nextElIndInPerm = this_1.indexesAndChoicesArrayLengthsSortedByLength.findIndex(function (x) { return x.index == elIndInPerm + 1; });
48
- this_1.actualAndPrevIndexesInPermAfterSortedByChoicesLength[permInd] = {
49
- actualIndex: elIndInPerm,
50
- indexOfPrevInPerm: prevElIndInPerm,
51
- indexOfNextInPerm: nextElIndInPerm
52
- };
53
- };
54
- var this_1 = this;
55
- for (var permInd = 0; permInd < keys.length; permInd++) {
56
- _loop_1(permInd);
57
- }
58
- };
59
- PermutationGeneratorForSet.prototype.isNewPermWithNewElementConsecutivelyDifferent = function (currentEl, elIndInChoices, elIndInPerm) {
60
- var _this = this;
61
- var newPerm = this.newPerm.slice();
62
- newPerm[elIndInPerm] = currentEl;
63
- var actualOrderedNewPerm = this.revertResultPermToInitialOrder(newPerm);
64
- if (this.passFunction) {
65
- var elArray_1 = [];
66
- actualOrderedNewPerm.forEach(function (elInd, i) { return elArray_1[i] = _this.elementList[elInd]; });
67
- var pass = this.passFunction(elArray_1.filter(function (x) { return x; })); // Remove undefineds, since some array elements are undefined when building
68
- return pass;
69
- }
70
- return true;
71
- };
72
- // Shouldn't be checked in this class, better to check in a high level, like custom permutation or listschuduler
73
- // Means previous actual element is not same with current one
74
- PermutationGeneratorForSet.prototype.isNewPermWithNewElementConsecutivelyDifferent_ = function (currentEl, elIndInChoices, elIndInPerm) {
75
- var _this = this;
76
- var newPerm = this.newPerm.slice();
41
+ isNewPermutationPassingFunction(currentEl, elIndInPerm) {
42
+ const newPerm = this.newPerm.slice();
77
43
  newPerm[elIndInPerm] = currentEl;
78
- var actualOrderedNewPerm = this.revertResultPermToInitialOrder(newPerm);
79
- // this block can be used upon need or comment
44
+ const actualOrderedNewPerm = this.revertResultPermToInitialOrder(newPerm);
80
45
  if (this.passFunction) {
81
- var elArray_2 = [];
82
- actualOrderedNewPerm.forEach(function (elInd, i) { return elArray_2[i] = _this.elementList[elInd]; });
83
- var pass = this.passFunction(elArray_2);
84
- return pass;
85
- }
86
- var actualOrderOfPrev = Number(this.actualOrderOfElements[0]);
87
- var prevEl = this.elementList[actualOrderOfPrev];
88
- var actualOrderOfCurr, currEl;
89
- for (var i = 1; i < actualOrderedNewPerm.length; i++) {
90
- actualOrderOfCurr = Number(this.actualOrderOfElements[i]);
91
- currEl = this.elementList[actualOrderedNewPerm[i]];
92
- if (currEl && prevEl && currEl != 0 && prevEl != 0 && Math.abs(actualOrderOfCurr - actualOrderOfPrev) == 1 && currEl == prevEl) {
93
- {
94
- return false;
95
- }
96
- }
97
- actualOrderOfPrev = actualOrderOfCurr;
98
- prevEl = currEl;
46
+ const elArray = [];
47
+ actualOrderedNewPerm.forEach((elInd, i) => (elArray[i] = this.elementList[elInd]));
48
+ const passed = this.passFunction(elArray.filter((x) => x)); // Remove nulls, since some array elements are undefined when building
49
+ return passed;
99
50
  }
100
51
  return true;
101
- };
102
- // Means previous actual element is not same with current one
103
- PermutationGeneratorForSet.prototype.isPreviousElementDifferentOrCanSkipThisFn = function (currentEl, elIndInChoices, elIndInPerm) {
104
- var prevElIndInPerm = this.actualAndPrevIndexesInPermAfterSortedByChoicesLength[elIndInPerm].indexOfPrevInPerm; // this.indexesAndChoicesArrayLengthsSortedByLength.indexOf(this.indexesAndChoicesArrayLengths.filter(x=>x.index == elIndInPerm-1)[0]);
105
- var nextElIndInPerm = this.actualAndPrevIndexesInPermAfterSortedByChoicesLength[elIndInPerm].indexOfNextInPerm; // this.indexesAndChoicesArrayLengthsSortedByLength.indexOf(this.indexesAndChoicesArrayLengths.filter(x=>x.index == elIndInPerm-1)[0]);
106
- elIndInPerm = this.indexesAndChoicesArrayLengthsSortedByLength[elIndInPerm].index;
107
- prevElIndInPerm = this.indexesAndChoicesArrayLengthsSortedByLength.indexOf(this.indexesAndChoicesArrayLengths.filter(function (x) { return x.index == elIndInPerm - 1; })[0]);
108
- if (elIndInPerm == 0 || !this.newPerm[prevElIndInPerm]) {
109
- return true; // if not set yet, return true
110
- }
111
- if (this.actualOrderOfElements[elIndInPerm] - this.actualOrderOfElements[prevElIndInPerm] != 1) {
112
- return true; // since this is not conseccutive, skip function
113
- }
114
- if (this.actualOrderOfElements[elIndInPerm] - this.actualOrderOfElements[prevElIndInPerm] == 1 &&
115
- (this.elementList[this.newPerm[elIndInPerm]] != this.elementList[this.newPerm[prevElIndInPerm]] &&
116
- this.indexesOfSameElements[this.newPerm[prevElIndInPerm]].indexOf(currentEl) == -1)) {
117
- return true; // they are consecutive and different from each other and also different from sameElementIndexes
118
- }
119
- if (this.elementList[this.newPerm[prevElIndInPerm]] == 0 || this.elementList[currentEl] == 0) {
120
- return true; // skip the zeros, since they can be consecutive
121
- }
122
- return false;
123
- };
52
+ }
124
53
  // Change choice arrays elements order to take low choices front to place them firstly
125
- PermutationGeneratorForSet.prototype.reorderListAndChoicesAccordingToChoicesCount = function () {
126
- var _this = this;
127
- this.indexesAndChoicesArrayLengths = [];
128
- this.choicesArrays.forEach((function (list, ind) { return _this.indexesAndChoicesArrayLengths.push({ index: ind, length: list.length }); }));
129
- // debugger
130
- this.indexesAndChoicesArrayLengthsSortedByLength = this.indexesAndChoicesArrayLengths.slice()
131
- .sort(function (el1, el2) { return el1.length < el2.length ? -1 : el1.length == el2.length && el1.index < el2.index ? -1 : 1; });
132
- var newChoicesArray = [];
133
- var newSet = [];
134
- for (var i = 0; i < this.indexesAndChoicesArrayLengthsSortedByLength.length; i++) {
135
- newChoicesArray[i] = this.choicesArrays[this.indexesAndChoicesArrayLengthsSortedByLength[i].index];
136
- newSet[i] = this.set[this.indexesAndChoicesArrayLengthsSortedByLength[i].index];
54
+ reorderListAndChoicesAccordingToChoicesCount() {
55
+ this.indexesAndChoicesCounts = [];
56
+ this.choicesArrays.forEach((list, ind) => this.indexesAndChoicesCounts.push({ index: ind, length: list.length }));
57
+ this.indexesAndChoicesCountsSortedByLength = this.indexesAndChoicesCounts
58
+ .slice()
59
+ .sort((el1, el2) => (el1.length < el2.length ? -1 : el1.length === el2.length && el1.index < el2.index ? -1 : 1));
60
+ const newChoicesArray = [];
61
+ const newSet = [];
62
+ for (let i = 0; i < this.indexesAndChoicesCountsSortedByLength.length; i++) {
63
+ newChoicesArray[i] = this.choicesArrays[this.indexesAndChoicesCountsSortedByLength[i].index];
64
+ newSet[i] = this.indexList[this.indexesAndChoicesCountsSortedByLength[i].index];
137
65
  }
138
66
  this.choicesArrays = newChoicesArray;
139
67
  this.choicesArraysInitial = JSON.parse(JSON.stringify(this.choicesArrays));
140
- };
141
- PermutationGeneratorForSet.prototype.revertResultPermToInitialOrder = function (newPerm) {
142
- var resultPerm = [];
143
- for (var i = 0; i < newPerm.length; i++) {
144
- resultPerm[this.indexesAndChoicesArrayLengthsSortedByLength[i].index] = newPerm[i];
145
- }
146
- return resultPerm;
147
- };
148
- PermutationGeneratorForSet.prototype.initChoicesArray = function () {
68
+ }
69
+ initChoicesArray() {
149
70
  this.choicesArrays = [];
150
71
  this.choicesArraysInitial = [];
151
- for (var i = 0; i < this.set.length; i++) {
152
- this.choicesArrays.push(this.choicesByIndex[i] && this.choicesByIndex[i].length ?
153
- this.choicesByIndex[i].slice() : this.set.slice());
154
- if (this.randomizeChoices) {
155
- Utils_1.Utils.shuffle(this.choicesArrays[i]);
156
- }
72
+ for (let i = 0; i < this.indexList.length; i++) {
73
+ this.choicesArrays.push(this.choicesByIndex[i] && this.choicesByIndex[i].length
74
+ ? this.choicesByIndex[i].slice()
75
+ : this.indexList.slice());
157
76
  this.choicesArraysInitial.push(this.choicesArrays[i].slice());
158
77
  }
159
- };
160
- PermutationGeneratorForSet.prototype.init = function () {
161
- // Initialize the new permutation
162
- for (var i = 0; i < this.numOfEl; i++) {
163
- for (var j = 0; j < this.choicesArrays[i].length; j++) {
78
+ }
79
+ init() {
80
+ for (let i = 0; i < this.size; i++) {
81
+ for (let j = 0; j < this.choicesArrays[i].length; j++) {
164
82
  if (this.newPerm.indexOf(this.choicesArrays[i][j]) < 0) {
165
83
  this.newPerm[i] = this.choicesArrays[i][j];
166
- this.elIsUsedDict[this.newPerm[i]] = true; // used
84
+ this.visitedDict[this.newPerm[i]] = true; // used
167
85
  this.currentIndsOfChoices[i] = j;
168
86
  break;
169
87
  }
170
88
  }
171
89
  }
172
- // Remove last element so that algorithm resolve it
173
- this.currentIndsOfChoices[this.numOfEl - 1] = -1; // make last element as to be next
174
- this.elIsUsedDict[this.newPerm[this.numOfEl - 1]] = false; // not-used
175
- this.newPerm[this.numOfEl - 1] = null;
176
- };
177
- PermutationGeneratorForSet.prototype.next = function () {
178
- var nextPerm = this.getNextPerm();
179
- if (nextPerm) {
180
- // If nextPerm does not include empty item, any undefined
181
- // ?? Understand, sometimes there is an empty element, case should be detected
182
- while (nextPerm.filter(function (x) { return x || x == 0; }).length < nextPerm.length) {
90
+ this.currentIndsOfChoices[this.size - 1] = -1;
91
+ this.visitedDict[this.newPerm[this.size - 1]] = false;
92
+ this.newPerm[this.size - 1] = null;
93
+ }
94
+ next() {
95
+ let nextPerm = this.getNextPerm();
96
+ if ((nextPerm === null || nextPerm === void 0 ? void 0 : nextPerm.length) > 0) {
97
+ while (nextPerm.filter((x) => x || x === 0).length < nextPerm.length) {
183
98
  nextPerm = this.getNextPerm();
184
- if (!nextPerm || nextPerm.length == 0) {
99
+ if (!nextPerm || nextPerm.length === 0) {
185
100
  return { done: true };
186
101
  }
187
102
  }
@@ -190,135 +105,102 @@ var PermutationGeneratorForSet = /** @class */ (function () {
190
105
  else {
191
106
  return { done: true };
192
107
  }
193
- };
194
- PermutationGeneratorForSet.prototype.getNextPerm = function () {
195
- var _this = this;
196
- var _loop_2 = function (i) {
197
- // To make consecutives different
198
- var elIndInPerm = this_2.indexesAndChoicesArrayLengthsSortedByLength[i].index;
199
- var prevElIndInPerm = this_2.indexesAndChoicesArrayLengthsSortedByLength.indexOf(this_2.indexesAndChoicesArrayLengths.filter(function (x) { return x.index == elIndInPerm - 1; })[0]);
200
- var choicesArray = [];
201
- try {
202
- choicesArray = this_2.choicesArraysInitial[i].filter(function (x) { return !_this.elIsUsedDict[x]; });
203
- }
204
- catch (error) {
205
- }
206
- var el = this_2.getAndSetPossibleNextElementForNewPerm(this_2.newPerm, choicesArray, this_2.currentIndsOfChoices, i);
207
- while (el == 'EXISTINARRAY' || el == 'TRIEDBEFORE') {
208
- el = this_2.getAndSetPossibleNextElementForNewPerm(this_2.newPerm, choicesArray, this_2.currentIndsOfChoices, i);
209
- }
210
- if (!el && el != 0) { // if el is undefined or null
211
- if (this_2.newPerm.filter(function (x) { return x == null; }).length == 0) { // if it is done, return completed
212
- return { value: this_2.newPerm.slice() };
108
+ }
109
+ getNextPerm() {
110
+ for (let i = this.size - 1; i >= 0 && i < this.size; i++) {
111
+ let choicesArray = [];
112
+ choicesArray = this.choicesArraysInitial[i].filter((x) => !this.visitedDict[x]);
113
+ const el = this.getAndSetPossibleNextElementForNewPerm(this.newPerm, choicesArray, this.currentIndsOfChoices, i);
114
+ if (el === undefined) {
115
+ if (!this.newPerm.some((x) => x === null)) {
116
+ return this.newPerm.slice();
213
117
  }
214
- while (!this_2.goBack(this_2.newPerm, this_2.choicesArrays, this_2.currentIndsOfChoices, --i)) {
215
- if (i <= 0) { // if there is only one element, then i can be less than 0, that is negative
216
- return { value: void 0 };
118
+ while (!this.goBack(this.newPerm, this.choicesArrays, this.currentIndsOfChoices, --i)) {
119
+ if (i <= 0) {
120
+ return undefined;
217
121
  }
218
122
  }
219
123
  }
220
124
  else {
221
- this_2.elIsUsedDict[this_2.newPerm[i]] = false; // old one, not-used
222
- this_2.newPerm[i] = el;
223
- this_2.elIsUsedDict[this_2.newPerm[i]] = true; // new one, used
125
+ this.newPerm[i] = el;
126
+ this.visitedDict[this.newPerm[i]] = true;
224
127
  }
225
- out_i_1 = i;
226
- };
227
- var this_2 = this, out_i_1;
228
- for (var i = this.numOfEl - 1; i >= 0 && i < this.numOfEl; i++) {
229
- var state_1 = _loop_2(i);
230
- i = out_i_1;
231
- if (typeof state_1 === "object")
232
- return state_1.value;
233
128
  }
234
129
  return this.newPerm.slice();
235
- };
236
- PermutationGeneratorForSet.prototype.goBack = function (newPerm, choicesArrays, currentIndsInChoices, elInd) {
237
- // reset chocies arrays until end, there should not be need but code is a little buggy
238
- choicesArrays[elInd] = (this.choicesArraysInitial[elInd] || []).slice();
239
- if (elInd + 1 < choicesArrays.length) {
240
- choicesArrays[elInd + 1] = (this.choicesArraysInitial[elInd + 1] || []).slice();
241
- }
242
- if (elInd >= 0 && elInd < this.numOfEl) {
243
- if (currentIndsInChoices[elInd] < choicesArrays[elInd].length - 1) {
244
- currentIndsInChoices[elInd + 1] = -1; // Reset old
245
- this.elIsUsedDict[newPerm[elInd + 1]] = false;
246
- newPerm[elInd + 1] = null;
247
- currentIndsInChoices[elInd]++; // increment current
248
- if (!this.elIsUsedDict[choicesArrays[elInd][currentIndsInChoices[elInd]]]
249
- &&
250
- this.isNewPermWithNewElementConsecutivelyDifferent(choicesArrays[elInd][currentIndsInChoices[elInd]], currentIndsInChoices[elInd], elInd)) {
251
- this.elIsUsedDict[newPerm[elInd]] = false; // not-used
252
- newPerm[elInd] = choicesArrays[elInd][currentIndsInChoices[elInd]];
253
- this.elIsUsedDict[newPerm[elInd]] = true; // used
130
+ }
131
+ goBack(newPerm, choicesArrayWithIndexes, selectedIndexesForPerm, elInd) {
132
+ if (elInd + 1 < choicesArrayWithIndexes.length) {
133
+ choicesArrayWithIndexes[elInd + 1] = this.choicesArraysInitial[elInd + 1].slice();
134
+ selectedIndexesForPerm[elInd + 1] = -1;
135
+ this.visitedDict[newPerm[elInd + 1]] = false;
136
+ newPerm[elInd + 1] = null;
137
+ }
138
+ if (elInd >= 0 && elInd < this.size) {
139
+ choicesArrayWithIndexes[elInd] = this.choicesArraysInitial[elInd].slice();
140
+ if (selectedIndexesForPerm[elInd] === choicesArrayWithIndexes[elInd].length - 1) {
141
+ return false;
142
+ }
143
+ else {
144
+ selectedIndexesForPerm[elInd]++;
145
+ if (!this.visitedDict[choicesArrayWithIndexes[elInd][selectedIndexesForPerm[elInd]]] &&
146
+ this.isNewPermutationPassingFunction(choicesArrayWithIndexes[elInd][selectedIndexesForPerm[elInd]], elInd)) {
147
+ this.visitedDict[newPerm[elInd]] = false;
148
+ newPerm[elInd] = choicesArrayWithIndexes[elInd][selectedIndexesForPerm[elInd]];
149
+ this.visitedDict[newPerm[elInd]] = true;
254
150
  return true;
255
151
  }
256
152
  else {
257
- return this.goBack(newPerm, choicesArrays, currentIndsInChoices, elInd);
153
+ return this.goBack(newPerm, choicesArrayWithIndexes, selectedIndexesForPerm, elInd);
258
154
  }
259
155
  }
260
- else {
261
- currentIndsInChoices[elInd + 1] = -1; // Reset old
262
- this.elIsUsedDict[newPerm[elInd + 1]] = false; // not-used
263
- newPerm[elInd + 1] = null;
264
- return false;
265
- }
266
- }
267
- // choicesArrays[elInd + 1] = this.choicesArraysInitial[elInd + 1].slice()
268
- return false;
269
- };
270
- PermutationGeneratorForSet.prototype.getAndSetPossibleNextElementForNewPerm = function (newPerm, choices, currentIndsInChoices, elInd) {
271
- var _this = this;
272
- // debugger
273
- if (elInd >= this.numOfEl) {
274
- currentIndsInChoices[elInd] = 0; // will go back
275
- return null;
276
156
  }
277
- // If current element index does not exist then set it to zero
278
- if (!(currentIndsInChoices[elInd] >= 0)) {
279
- currentIndsInChoices[elInd] = 0; // try starting from 0
157
+ }
158
+ getAndSetPossibleNextElementForNewPerm(newPerm, choices, currentIndsInChoices, elInd) {
159
+ if (currentIndsInChoices[elInd] < 0) {
160
+ currentIndsInChoices[elInd] = 0;
280
161
  }
281
162
  else {
282
163
  currentIndsInChoices[elInd]++;
283
164
  }
284
165
  if (currentIndsInChoices[elInd] >= 0 && currentIndsInChoices[elInd] < choices.length) {
285
- // If exist any where in new perm
286
- if (!this.isNewPermWithNewElementConsecutivelyDifferent(choices[currentIndsInChoices[elInd]], currentIndsInChoices[elInd], elInd)) {
287
- return 'EXISTINARRAY';
166
+ if (!this.isNewPermutationPassingFunction(choices[currentIndsInChoices[elInd]], elInd)) {
167
+ return this.getAndSetPossibleNextElementForNewPerm(newPerm, choices, currentIndsInChoices, elInd);
288
168
  }
289
- this.elIsUsedDict[newPerm[elInd]] = false;
290
169
  newPerm[elInd] = choices[currentIndsInChoices[elInd]];
291
- this.elIsUsedDict[newPerm[elInd]] = true;
292
- // from the choices list Remove the same elements with the one which is set right now
293
- this.choicesArrays[elInd] = this.choicesArrays[elInd].filter(function (x) {
294
- return _this.indexesOfSameElements[newPerm[elInd]] && _this.indexesOfSameElements[newPerm[elInd]].indexOf(x) == -1;
295
- });
170
+ this.visitedDict[newPerm[elInd]] = true;
171
+ this.choicesArrays[elInd] = this.choicesArrays[elInd].filter((x) => this.indexesOfSameElements[newPerm[elInd]] && this.indexesOfSameElements[newPerm[elInd]].indexOf(x) === -1);
296
172
  return choices[currentIndsInChoices[elInd]];
297
173
  }
298
174
  else {
299
- this.elIsUsedDict[newPerm[elInd]] = false;
175
+ this.visitedDict[newPerm[elInd]] = false;
300
176
  currentIndsInChoices[elInd] = -1;
301
177
  newPerm[elInd] = null;
178
+ return undefined;
302
179
  }
303
- return undefined;
304
- };
305
- PermutationGeneratorForSet.prototype.validateParameters = function (elementSet, choicesByIndex) {
306
- if (!elementSet || elementSet.length == 0) {
307
- console.warn('Element list to permutate should be provided!');
180
+ }
181
+ validateParameters(elementSet, choicesByIndex) {
182
+ if (!elementSet || elementSet.length === 0) {
308
183
  return false;
309
184
  }
310
- var keys = Object.keys(choicesByIndex);
311
- for (var i = 0; i < keys.length; i++) {
312
- for (var j = 0; j < choicesByIndex[keys[i]].length; j++) {
313
- if (elementSet.indexOf(choicesByIndex[keys[i]][j]) < 0) {
314
- console.warn('All choices should be in set!');
185
+ for (const key in choicesByIndex) {
186
+ if (!choicesByIndex[key]) {
187
+ continue;
188
+ }
189
+ for (const anotherKey of choicesByIndex[key]) {
190
+ if (elementSet.indexOf(anotherKey) < 0) {
315
191
  return false;
316
192
  }
317
193
  }
318
194
  }
319
195
  return true;
320
- };
321
- return PermutationGeneratorForSet;
322
- }());
196
+ }
197
+ revertResultPermToInitialOrder(newPerm) {
198
+ const resultPerm = [];
199
+ for (let i = 0; i < newPerm.length; i++) {
200
+ resultPerm[this.indexesAndChoicesCountsSortedByLength[i].index] = newPerm[i];
201
+ }
202
+ return resultPerm;
203
+ }
204
+ }
323
205
  exports.PermutationGeneratorForSet = PermutationGeneratorForSet;
324
206
  //# sourceMappingURL=PermutationGeneratorForSet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PermutationGeneratorForSet.js","sourceRoot":"","sources":["../src/PermutationGeneratorForSet.ts"],"names":[],"mappings":";;;AAAA,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AK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;SAC9E;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAxPD,gEAwPC"}
package/lib/index.js CHANGED
@@ -1,5 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var CustomPermutation_1 = require("./CustomPermutation");
3
+ const CustomPermutation_1 = require("./CustomPermutation");
4
+ let customPerm = new CustomPermutation_1.default([], {}, {});
5
+ let count = 0;
6
+ while (true) {
7
+ let next = customPerm.next();
8
+ if (!next) {
9
+ break;
10
+ }
11
+ count++;
12
+ }
4
13
  module.exports = CustomPermutation_1.default;
5
14
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,yDAAoD;AACpD,MAAM,CAAC,OAAO,GAAG,2BAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,2DAAoD;AAEpD,IAAI,UAAU,GAAG,IAAI,2BAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACnD,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,OAAO,IAAI,EAAE;IACX,IAAI,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAE7B,IAAI,CAAC,IAAI,EAAE;QACT,MAAM;KACP;IAED,KAAK,EAAE,CAAC;CACT;AAED,MAAM,CAAC,OAAO,GAAG,2BAAiB,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "custom-permutation",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
4
4
  "description": "Permutation generator with custom options.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "scripts": {
8
8
  "test": "jest --config jestconfig.json",
9
9
  "build": "tsc",
10
- "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
10
+ "format": "prettier --write \"src/**/*.ts\"",
11
11
  "lint": "tslint -p tsconfig.json",
12
12
  "prepare": "npm run build",
13
13
  "prepublishOnly": "npm test && npm run preversion",
@@ -39,9 +39,9 @@
39
39
  "jest": "^27.0.6",
40
40
  "prettier": "^2.3.2",
41
41
  "ts-jest": "^27.0.3",
42
+ "ts-node": "^10.9.2",
42
43
  "tslint": "^6.1.3",
43
44
  "tslint-config-prettier": "^1.18.0",
44
45
  "typescript": "^4.3.5"
45
- },
46
- "dependencies": {}
46
+ }
47
47
  }
package/lib/Enums.d.ts DELETED
@@ -1,39 +0,0 @@
1
- export declare enum SlotTypeEnum {
2
- Weekday = 1,
3
- Holiday = 2
4
- }
5
- export declare enum MonthEnum {
6
- January = 0,
7
- February = 1,
8
- March = 2,
9
- April = 3,
10
- May = 4,
11
- June = 5,
12
- July = 6,
13
- August = 7,
14
- September = 8,
15
- October = 9,
16
- November = 10,
17
- December = 11
18
- }
19
- export declare enum CheckFunctionsErrorTypeEnum {
20
- SamePersonInSameDayInBothList = 0,
21
- ConsecutiveSamePersonInSameList = 1,
22
- SamePersonAtNorthWest = 2,
23
- SamePersonAtNorthEast = 3,
24
- SamePersonAtSouthEast = 4,
25
- SamePersonAtSouthWest = 5
26
- }
27
- export declare enum PermResultTypeEnum {
28
- FOUND = 1,
29
- TRYNEXT = 2,
30
- ENDOFPERMUTATION = 3
31
- }
32
- export declare enum CheckResultEnum {
33
- TRYNEXT = 1,
34
- TRYNEXTWD = 2,
35
- TRYNEXTHD = 3,
36
- TRYNEXTHDANDWDBOTH = 4,
37
- NOSOLUTION = 5,
38
- NOTTRIEDYET = 6
39
- }