@tuprolog/2p-full 0.30.5 → 0.31.1-dev01

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.
Files changed (70) hide show
  1. package/2p-bdd.js +609 -0
  2. package/2p-bdd.js.map +1 -0
  3. package/2p-core.js +12057 -0
  4. package/2p-core.js.map +1 -0
  5. package/2p-datalog.js +8 -0
  6. package/2p-datalog.js.map +1 -0
  7. package/2p-dsl-core.js +8 -0
  8. package/2p-dsl-core.js.map +1 -0
  9. package/2p-dsl-solve.js +8 -0
  10. package/2p-dsl-solve.js.map +1 -0
  11. package/2p-dsl-theory.js +8 -0
  12. package/2p-dsl-theory.js.map +1 -0
  13. package/2p-dsl-unify.js +8 -0
  14. package/2p-dsl-unify.js.map +1 -0
  15. package/2p-full.d.ts +270 -0
  16. package/2p-full.js +21 -0
  17. package/2p-full.js.map +1 -0
  18. package/2p-io-lib.js +3600 -0
  19. package/2p-io-lib.js.map +1 -0
  20. package/2p-oop-lib.js +3660 -0
  21. package/2p-oop-lib.js.map +1 -0
  22. package/2p-parser-core.js +1450 -0
  23. package/2p-parser-core.js.map +1 -0
  24. package/2p-parser-js.js +29 -0
  25. package/2p-parser-js.js.map +1 -0
  26. package/2p-parser-theory.js +114 -0
  27. package/2p-parser-theory.js.map +1 -0
  28. package/2p-repl.js +519 -0
  29. package/2p-repl.js.map +1 -0
  30. package/2p-serialize-core.js +8 -0
  31. package/2p-serialize-core.js.map +1 -0
  32. package/2p-serialize-theory.js +8 -0
  33. package/2p-serialize-theory.js.map +1 -0
  34. package/2p-solve-classic.js +3329 -0
  35. package/2p-solve-classic.js.map +1 -0
  36. package/2p-solve-concurrent.js +8 -0
  37. package/2p-solve-concurrent.js.map +1 -0
  38. package/2p-solve-plp.js +44 -0
  39. package/2p-solve-plp.js.map +1 -0
  40. package/2p-solve-problog.js +4547 -0
  41. package/2p-solve-problog.js.map +1 -0
  42. package/2p-solve-streams.js +3028 -0
  43. package/2p-solve-streams.js.map +1 -0
  44. package/2p-solve.js +16824 -0
  45. package/2p-solve.js.map +1 -0
  46. package/2p-theory.js +4902 -0
  47. package/2p-theory.js.map +1 -0
  48. package/2p-unify.js +957 -0
  49. package/2p-unify.js.map +1 -0
  50. package/2p-utils.js +1423 -0
  51. package/2p-utils.js.map +1 -0
  52. package/88b0986a7186d029-atomicfu-js-ir.js +8 -0
  53. package/88b0986a7186d029-atomicfu-js-ir.js.map +1 -0
  54. package/clikt-clikt-js-ir.js +7240 -0
  55. package/clikt-clikt-js-ir.js.map +1 -0
  56. package/kotlin-kotlin-stdlib-js-ir.js +11847 -0
  57. package/kotlin-kotlin-stdlib-js-ir.js.map +1 -0
  58. package/kotlin-kotlinx-atomicfu-runtime-js-ir.js +8 -0
  59. package/kotlin-kotlinx-atomicfu-runtime-js-ir.js.map +1 -0
  60. package/kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js +8 -0
  61. package/kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js.map +1 -0
  62. package/kt-math.js +11348 -0
  63. package/kt-math.js.map +1 -0
  64. package/package.json +4 -36
  65. package/CONTRIBUTORS +0 -10
  66. package/LICENSE +0 -202
  67. package/kotlin/2p-full/it/unibo/tuprolog/tuprolog.kjsm +0 -0
  68. package/kotlin/2p-full.js +0 -15
  69. package/kotlin/2p-full.js.map +0 -1
  70. package/kotlin/2p-full.meta.js +0 -1
package/2p-theory.js ADDED
@@ -0,0 +1,4902 @@
1
+ (function (_, kotlin_kotlin, kotlin_it_unibo_tuprolog_core, kotlin_it_unibo_tuprolog_utils, kotlin_it_unibo_tuprolog_unify) {
2
+ 'use strict';
3
+ //region block: imports
4
+ var imul = Math.imul;
5
+ var asIterable = kotlin_kotlin.$_$.h8;
6
+ var any = kotlin_kotlin.$_$.g8;
7
+ var asSequence = kotlin_kotlin.$_$.g3;
8
+ var Unit_getInstance = kotlin_kotlin.$_$.r2;
9
+ var getKClassFromExpression = kotlin_kotlin.$_$.b;
10
+ var joinToString$default = kotlin_kotlin.$_$.e;
11
+ var classMeta = kotlin_kotlin.$_$.m6;
12
+ var setMetadataFor = kotlin_kotlin.$_$.j7;
13
+ var toList = kotlin_kotlin.$_$.p9;
14
+ var none = kotlin_kotlin.$_$.e9;
15
+ var emptyList = kotlin_kotlin.$_$.s3;
16
+ var asIterable_0 = kotlin_kotlin.$_$.b3;
17
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.b1;
18
+ var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.c1;
19
+ var itemWiseEquals = kotlin_it_unibo_tuprolog_utils.$_$.c1;
20
+ var getKClass = kotlin_kotlin.$_$.c;
21
+ var itemWiseHashCode = kotlin_it_unibo_tuprolog_utils.$_$.d1;
22
+ var itemWiseHashCode_0 = kotlin_it_unibo_tuprolog_utils.$_$.e1;
23
+ var objectMeta = kotlin_kotlin.$_$.i7;
24
+ var interfaceMeta = kotlin_kotlin.$_$.u6;
25
+ var first = kotlin_kotlin.$_$.x3;
26
+ var hashCode = kotlin_kotlin.$_$.t6;
27
+ var THROW_CCE = kotlin_kotlin.$_$.sb;
28
+ var equals = kotlin_kotlin.$_$.o6;
29
+ var toString = kotlin_kotlin.$_$.n7;
30
+ var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.p1;
31
+ var asReversed = kotlin_kotlin.$_$.d3;
32
+ var isInterface = kotlin_kotlin.$_$.y6;
33
+ var lazy = kotlin_kotlin.$_$.xb;
34
+ var KProperty1 = kotlin_kotlin.$_$.d8;
35
+ var getPropertyCallableRef = kotlin_kotlin.$_$.r6;
36
+ var CoroutineImpl = kotlin_kotlin.$_$.c6;
37
+ var SequenceScope = kotlin_kotlin.$_$.e8;
38
+ var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.b6;
39
+ var sequence = kotlin_kotlin.$_$.j9;
40
+ var listOf = kotlin_kotlin.$_$.i4;
41
+ var mergeSequences = kotlin_it_unibo_tuprolog_utils.$_$.g1;
42
+ var sequenceOf = kotlin_kotlin.$_$.i9;
43
+ var flatten = kotlin_kotlin.$_$.v8;
44
+ var compareTo = kotlin_it_unibo_tuprolog_utils.$_$.h;
45
+ var LongIndexed = kotlin_it_unibo_tuprolog_utils.$_$.i;
46
+ var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_utils.$_$.d;
47
+ var copyToArray = kotlin_kotlin.$_$.p3;
48
+ var plus = kotlin_kotlin.$_$.b5;
49
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.c1;
50
+ var minOrNull = kotlin_kotlin.$_$.m4;
51
+ var ensureNotNull = kotlin_kotlin.$_$.vb;
52
+ var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.f1;
53
+ var map = kotlin_kotlin.$_$.c9;
54
+ var sum = kotlin_kotlin.$_$.k9;
55
+ var Collection = kotlin_kotlin.$_$.t2;
56
+ var dequeOf = kotlin_it_unibo_tuprolog_utils.$_$.x;
57
+ var addFirst = kotlin_it_unibo_tuprolog_utils.$_$.p;
58
+ var filter = kotlin_kotlin.$_$.r8;
59
+ var emptySequence = kotlin_kotlin.$_$.n8;
60
+ var buffered = kotlin_it_unibo_tuprolog_utils.$_$.q;
61
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.j3;
62
+ var dequeOf_0 = kotlin_it_unibo_tuprolog_utils.$_$.v;
63
+ var Companion_getInstance_1 = kotlin_it_unibo_tuprolog_utils.$_$.b;
64
+ var firstOrNull = kotlin_kotlin.$_$.s8;
65
+ var NotImplementedError = kotlin_kotlin.$_$.nb;
66
+ var take = kotlin_kotlin.$_$.m9;
67
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.s1;
68
+ var Long = kotlin_kotlin.$_$.mb;
69
+ var UnsupportedOperationException_init_$Create$ = kotlin_kotlin.$_$.c2;
70
+ var Companion_getInstance_2 = kotlin_it_unibo_tuprolog_core.$_$.b1;
71
+ var Companion_getInstance_3 = kotlin_it_unibo_tuprolog_core.$_$.i1;
72
+ var Companion_getInstance_4 = kotlin_it_unibo_tuprolog_core.$_$.d1;
73
+ var numberRangeToNumber = kotlin_kotlin.$_$.e7;
74
+ var plus_0 = kotlin_kotlin.$_$.g9;
75
+ var getTag = kotlin_it_unibo_tuprolog_utils.$_$.m;
76
+ var containsTag = kotlin_it_unibo_tuprolog_utils.$_$.l;
77
+ var Companion_getInstance_5 = kotlin_it_unibo_tuprolog_core.$_$.v;
78
+ var first_0 = kotlin_kotlin.$_$.y3;
79
+ var Companion_getInstance_6 = kotlin_it_unibo_tuprolog_unify.$_$.a;
80
+ var filterNotNull = kotlin_kotlin.$_$.p8;
81
+ var Taggable = kotlin_it_unibo_tuprolog_utils.$_$.n;
82
+ var filterNot = kotlin_kotlin.$_$.q8;
83
+ var asSequence_0 = kotlin_kotlin.$_$.h3;
84
+ var toLong = kotlin_kotlin.$_$.l7;
85
+ var emptyMap = kotlin_kotlin.$_$.t3;
86
+ var toList_0 = kotlin_kotlin.$_$.n5;
87
+ var listOf_0 = kotlin_kotlin.$_$.h4;
88
+ var none_0 = kotlin_kotlin.$_$.v4;
89
+ var dequeOf_1 = kotlin_it_unibo_tuprolog_utils.$_$.w;
90
+ var Pair = kotlin_kotlin.$_$.qb;
91
+ var flatMap = kotlin_kotlin.$_$.u8;
92
+ var toMutableList = kotlin_kotlin.$_$.u5;
93
+ var toMutableList_0 = kotlin_kotlin.$_$.q9;
94
+ var addFirst_0 = kotlin_it_unibo_tuprolog_utils.$_$.o;
95
+ var addAll = kotlin_kotlin.$_$.y2;
96
+ //endregion
97
+ //region block: pre-declaration
98
+ setMetadataFor(AbstractClauseCollection, 'AbstractClauseCollection', classMeta, undefined, undefined, undefined, undefined, []);
99
+ setMetadataFor(AbstractMutableReteClauseCollection, 'AbstractMutableReteClauseCollection', classMeta, AbstractClauseCollection, undefined, undefined, undefined, []);
100
+ setMetadataFor(AbstractReteClauseCollection, 'AbstractReteClauseCollection', classMeta, AbstractClauseCollection, undefined, undefined, undefined, []);
101
+ setMetadataFor(Companion, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
102
+ function get(clause) {
103
+ return this.getFifoOrdered(clause);
104
+ }
105
+ function add(clause) {
106
+ return this.addLast(clause);
107
+ }
108
+ function add_0(clause) {
109
+ return this.v1l(clause);
110
+ }
111
+ function retrieve(clause) {
112
+ return this.retrieveFirst(clause);
113
+ }
114
+ function retrieve_0(clause) {
115
+ return this.z1l(clause);
116
+ }
117
+ setMetadataFor(ClauseQueue, 'ClauseQueue', interfaceMeta, undefined, undefined, undefined, undefined, []);
118
+ setMetadataFor(Companion_0, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
119
+ setMetadataFor(MutableClauseQueue, 'MutableClauseQueue', interfaceMeta, undefined, [ClauseQueue], undefined, undefined, []);
120
+ setMetadataFor(RetrieveResult, 'RetrieveResult', classMeta, undefined, undefined, undefined, undefined, []);
121
+ setMetadataFor(Success, 'Success', classMeta, RetrieveResult, undefined, undefined, undefined, []);
122
+ setMetadataFor(Failure, 'Failure', classMeta, RetrieveResult, undefined, undefined, undefined, []);
123
+ setMetadataFor(MutableReteClauseQueue, 'MutableReteClauseQueue', classMeta, AbstractMutableReteClauseCollection, [MutableClauseQueue, AbstractMutableReteClauseCollection], undefined, undefined, []);
124
+ setMetadataFor(ReteClauseQueue, 'ReteClauseQueue', classMeta, AbstractReteClauseCollection, [ClauseQueue, AbstractReteClauseCollection], undefined, undefined, []);
125
+ setMetadataFor(AbstractReteNode$removeAllLazily$slambda, 'AbstractReteNode$removeAllLazily$slambda', classMeta, CoroutineImpl, undefined, undefined, undefined, [1]);
126
+ setMetadataFor(AbstractReteNode, 'AbstractReteNode', classMeta, undefined, undefined, undefined, undefined, []);
127
+ setMetadataFor(Companion_1, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
128
+ setMetadataFor(Utils$firstArguments$slambda, 'Utils$firstArguments$slambda', classMeta, CoroutineImpl, undefined, undefined, undefined, [1]);
129
+ setMetadataFor(Utils, 'Utils', objectMeta, undefined, undefined, undefined, undefined, []);
130
+ function get_innerClause() {
131
+ return this.b1();
132
+ }
133
+ function plus_1(traversed) {
134
+ return Companion_getInstance_10().z1o(this.yq(), this.p1n(), plus(this.v1o(), traversed));
135
+ }
136
+ setMetadataFor(IndexedClause, 'IndexedClause', interfaceMeta, undefined, [LongIndexed], undefined, undefined, []);
137
+ setMetadataFor(IndexedClause$Companion$wrap$1, undefined, classMeta, undefined, [IndexedClause], undefined, undefined, []);
138
+ setMetadataFor(Companion_2, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
139
+ setMetadataFor(SituatedIndexedClause, 'SituatedIndexedClause', interfaceMeta, undefined, [IndexedClause], undefined, undefined, []);
140
+ setMetadataFor(SituatedIndexedClause$Companion$of$1, undefined, classMeta, undefined, [SituatedIndexedClause], undefined, undefined, []);
141
+ setMetadataFor(Companion_3, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
142
+ setMetadataFor(AbstractIndexingLeaf, 'AbstractIndexingLeaf', classMeta, AbstractReteNode, undefined, undefined, undefined, []);
143
+ setMetadataFor(AtomIndex, 'AtomIndex', classMeta, AbstractIndexingLeaf, undefined, undefined, undefined, []);
144
+ setMetadataFor(CompoundIndex, 'CompoundIndex', classMeta, AbstractReteNode, undefined, undefined, undefined, []);
145
+ setMetadataFor(DirectiveIndex$getCache$1$1, undefined, classMeta, undefined, undefined, undefined, undefined, []);
146
+ setMetadataFor(DirectiveIndex, 'DirectiveIndex', classMeta, AbstractReteNode, undefined, undefined, undefined, []);
147
+ setMetadataFor(NumericIndex, 'NumericIndex', classMeta, AbstractIndexingLeaf, undefined, undefined, undefined, []);
148
+ setMetadataFor(VariableIndex, 'VariableIndex', classMeta, AbstractIndexingLeaf, undefined, undefined, undefined, []);
149
+ setMetadataFor(ArityNode, 'ArityNode', classMeta, AbstractReteNode, undefined, undefined, undefined, []);
150
+ setMetadataFor(FamilyArityReteNode, 'FamilyArityReteNode', classMeta, ArityNode, undefined, undefined, undefined, []);
151
+ setMetadataFor(FamilyArityIndexingNode, 'FamilyArityIndexingNode', classMeta, FamilyArityReteNode, undefined, undefined, undefined, []);
152
+ setMetadataFor(FunctorNode, 'FunctorNode', classMeta, AbstractReteNode, undefined, undefined, undefined, []);
153
+ setMetadataFor(FunctorIndexingNode, 'FunctorIndexingNode', classMeta, FunctorNode, undefined, undefined, undefined, []);
154
+ setMetadataFor(RootNode, 'RootNode', classMeta, undefined, undefined, undefined, undefined, []);
155
+ setMetadataFor(RuleNode, 'RuleNode', classMeta, undefined, undefined, undefined, undefined, []);
156
+ setMetadataFor(TopLevelFunctorReteNode, 'TopLevelFunctorReteNode', classMeta, FunctorNode, undefined, undefined, undefined, []);
157
+ setMetadataFor(ZeroArityReteNode, 'ZeroArityReteNode', classMeta, ArityNode, undefined, undefined, undefined, []);
158
+ function get_isMutable() {
159
+ return false;
160
+ }
161
+ function get_rules() {
162
+ var tmp = asSequence(this.t1l());
163
+ return asIterable(filterNotNull(map(tmp, Theory$_get_rules_$lambda_c39n1s)));
164
+ }
165
+ function get_directives() {
166
+ var tmp = asSequence(this.t1l());
167
+ return asIterable(filterNotNull(map(tmp, Theory$_get_directives_$lambda_zbsn17)));
168
+ }
169
+ function plus_2(clause) {
170
+ return this.assertZ(clause);
171
+ }
172
+ function assertAFact(struct) {
173
+ return this.assertA(Companion_getInstance_5().of(struct));
174
+ }
175
+ function assertZFact(struct) {
176
+ return this.assertZ(Companion_getInstance_5().of(struct));
177
+ }
178
+ function retractByHead(head) {
179
+ return this.retract(Companion_getInstance_2().of(head, [Companion_getInstance_3().anonymous()]));
180
+ }
181
+ function retractAllByHead(head) {
182
+ return this.retractAll(Companion_getInstance_2().of(head, [Companion_getInstance_3().anonymous()]));
183
+ }
184
+ setMetadataFor(Theory, 'Theory', interfaceMeta, undefined, [Taggable], undefined, undefined, []);
185
+ setMetadataFor(AbstractTheory, 'AbstractTheory', classMeta, undefined, [Theory], undefined, undefined, []);
186
+ setMetadataFor(Companion_4, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
187
+ function get_isMutable_0() {
188
+ return true;
189
+ }
190
+ function toMutableTheory() {
191
+ return this;
192
+ }
193
+ function assertAFact_0(struct) {
194
+ return this.p1s(Companion_getInstance_5().of(struct));
195
+ }
196
+ function assertZFact_0(struct) {
197
+ return this.t1s(Companion_getInstance_5().of(struct));
198
+ }
199
+ function retractByHead_0(head) {
200
+ return this.e1t(Companion_getInstance_2().of(head, [Companion_getInstance_3().anonymous()]));
201
+ }
202
+ function retractAllByHead_0(head) {
203
+ return this.c1m(Companion_getInstance_2().of(head, [Companion_getInstance_3().anonymous()]));
204
+ }
205
+ setMetadataFor(MutableTheory, 'MutableTheory', interfaceMeta, undefined, [Theory], undefined, undefined, []);
206
+ setMetadataFor(RetractResult, 'RetractResult', classMeta, undefined, undefined, undefined, undefined, []);
207
+ setMetadataFor(Success_0, 'Success', classMeta, RetractResult, undefined, undefined, undefined, []);
208
+ setMetadataFor(Failure_0, 'Failure', classMeta, RetractResult, undefined, undefined, undefined, []);
209
+ setMetadataFor(Companion_5, 'Companion', objectMeta, undefined, undefined, undefined, undefined, []);
210
+ setMetadataFor(TheoryUtils, 'TheoryUtils', objectMeta, undefined, undefined, undefined, undefined, []);
211
+ setMetadataFor(_no_name_provided__qut3iv, undefined, classMeta, undefined, undefined, undefined, undefined, []);
212
+ setMetadataFor(AbstractIndexedTheory, 'AbstractIndexedTheory', classMeta, AbstractTheory, undefined, undefined, undefined, []);
213
+ setMetadataFor(AbstractListedTheory, 'AbstractListedTheory', classMeta, AbstractTheory, undefined, undefined, undefined, []);
214
+ setMetadataFor(IndexedTheory, 'IndexedTheory', classMeta, AbstractIndexedTheory, undefined, undefined, undefined, []);
215
+ setMetadataFor(ListedTheory, 'ListedTheory', classMeta, AbstractListedTheory, undefined, undefined, undefined, []);
216
+ setMetadataFor(MutableIndexedTheory, 'MutableIndexedTheory', classMeta, AbstractIndexedTheory, [AbstractIndexedTheory, MutableTheory], undefined, undefined, []);
217
+ setMetadataFor(MutableListedTheory, 'MutableListedTheory', classMeta, AbstractListedTheory, [AbstractListedTheory, MutableTheory], undefined, undefined, []);
218
+ //endregion
219
+ function AbstractClauseCollection(rete) {
220
+ this.j1l_1 = rete;
221
+ }
222
+ AbstractClauseCollection.prototype.k1l = function () {
223
+ return this.j1l_1.k1l();
224
+ };
225
+ AbstractClauseCollection.prototype.o = function () {
226
+ return this.j1l_1.o();
227
+ };
228
+ AbstractClauseCollection.prototype.l1l = function () {
229
+ return asIterable(this.j1l_1.m1l());
230
+ };
231
+ AbstractClauseCollection.prototype.n1l = function () {
232
+ return asIterable(this.j1l_1.n1l());
233
+ };
234
+ AbstractClauseCollection.prototype.d = function () {
235
+ return this.j1l_1.o1l();
236
+ };
237
+ AbstractClauseCollection.prototype.isEmpty = function () {
238
+ return this.d();
239
+ };
240
+ AbstractClauseCollection.prototype.p1l = function () {
241
+ return !this.d();
242
+ };
243
+ AbstractClauseCollection.prototype.isNonEmpty = function () {
244
+ return this.p1l();
245
+ };
246
+ AbstractClauseCollection.prototype.q1l = function (element) {
247
+ return any(this.j1l_1.r1l(element));
248
+ };
249
+ AbstractClauseCollection.prototype.contains = function (element) {
250
+ return this.q1l(element);
251
+ };
252
+ AbstractClauseCollection.prototype.s1l = function (elements) {
253
+ var tmp$ret$1;
254
+ $l$block: {
255
+ // Inline function 'kotlin.sequences.all' call
256
+ var tmp0_all = asSequence(elements);
257
+ var tmp0_iterator = tmp0_all.j();
258
+ while (tmp0_iterator.m()) {
259
+ var element = tmp0_iterator.p();
260
+ var tmp$ret$0;
261
+ // Inline function 'it.unibo.tuprolog.collections.AbstractClauseCollection.containsAll.<anonymous>' call
262
+ tmp$ret$0 = this.q1l(element);
263
+ if (!tmp$ret$0) {
264
+ tmp$ret$1 = false;
265
+ break $l$block;
266
+ }
267
+ }
268
+ tmp$ret$1 = true;
269
+ }
270
+ return tmp$ret$1;
271
+ };
272
+ AbstractClauseCollection.prototype.containsAll = function (elements) {
273
+ return this.s1l(elements);
274
+ };
275
+ AbstractClauseCollection.prototype.j = function () {
276
+ return this.j1l_1.t1l().j();
277
+ };
278
+ AbstractClauseCollection.prototype.toString = function () {
279
+ var tmp = getKClassFromExpression(this).kd();
280
+ return '' + tmp + '(' + joinToString$default(this, ', ', null, null, 0, null, null, 62, null) + ')';
281
+ };
282
+ function AbstractMutableReteClauseCollection(rete) {
283
+ AbstractClauseCollection.call(this, rete);
284
+ }
285
+ AbstractMutableReteClauseCollection.prototype.v1l = function (clause) {
286
+ this.j1l_1.w1l(clause);
287
+ return this.x1l();
288
+ };
289
+ AbstractMutableReteClauseCollection.prototype.add = function (clause) {
290
+ return this.v1l(clause);
291
+ };
292
+ AbstractMutableReteClauseCollection.prototype.y1l = function (clauses) {
293
+ // Inline function 'kotlin.collections.forEach' call
294
+ var tmp0_iterator = clauses.j();
295
+ while (tmp0_iterator.m()) {
296
+ var element = tmp0_iterator.p();
297
+ // Inline function 'it.unibo.tuprolog.collections.AbstractMutableReteClauseCollection.addAll.<anonymous>' call
298
+ this.j1l_1.w1l(element);
299
+ }
300
+ return this.x1l();
301
+ };
302
+ AbstractMutableReteClauseCollection.prototype.addAll = function (clauses) {
303
+ return this.y1l(clauses);
304
+ };
305
+ AbstractMutableReteClauseCollection.prototype.z1l = function (clause) {
306
+ var retracted = this.j1l_1.a1m(clause);
307
+ return none(retracted) ? new Failure(this.x1l()) : new Success(this.x1l(), toList(retracted));
308
+ };
309
+ AbstractMutableReteClauseCollection.prototype.retrieve = function (clause) {
310
+ return this.z1l(clause);
311
+ };
312
+ AbstractMutableReteClauseCollection.prototype.b1m = function (clause) {
313
+ var retracted = this.j1l_1.c1m(clause);
314
+ return none(retracted) ? new Failure(this.x1l()) : new Success(this.x1l(), toList(retracted));
315
+ };
316
+ AbstractMutableReteClauseCollection.prototype.retrieveAll = function (clause) {
317
+ return this.b1m(clause);
318
+ };
319
+ function AbstractReteClauseCollection(rete) {
320
+ AbstractClauseCollection.call(this, rete);
321
+ }
322
+ AbstractReteClauseCollection.prototype.v1l = function (clause) {
323
+ var tmp$ret$0;
324
+ // Inline function 'kotlin.apply' call
325
+ var tmp0_apply = this.j1l_1.f1m();
326
+ // Inline function 'kotlin.contracts.contract' call
327
+ // Inline function 'it.unibo.tuprolog.collections.AbstractReteClauseCollection.add.<anonymous>' call
328
+ tmp0_apply.w1l(TheoryUtils_getInstance().g1m(clause));
329
+ tmp$ret$0 = tmp0_apply;
330
+ return this.e1m(tmp$ret$0);
331
+ };
332
+ AbstractReteClauseCollection.prototype.add = function (clause) {
333
+ return this.v1l(clause);
334
+ };
335
+ AbstractReteClauseCollection.prototype.y1l = function (clauses) {
336
+ var tmp$ret$0;
337
+ // Inline function 'kotlin.apply' call
338
+ var tmp0_apply = this.j1l_1.f1m();
339
+ // Inline function 'kotlin.contracts.contract' call
340
+ // Inline function 'it.unibo.tuprolog.collections.AbstractReteClauseCollection.addAll.<anonymous>' call
341
+ // Inline function 'kotlin.collections.forEach' call
342
+ var tmp0_iterator = clauses.j();
343
+ while (tmp0_iterator.m()) {
344
+ var element = tmp0_iterator.p();
345
+ // Inline function 'it.unibo.tuprolog.collections.AbstractReteClauseCollection.addAll.<anonymous>.<anonymous>' call
346
+ tmp0_apply.w1l(TheoryUtils_getInstance().g1m(element));
347
+ }
348
+ tmp$ret$0 = tmp0_apply;
349
+ return this.e1m(tmp$ret$0);
350
+ };
351
+ AbstractReteClauseCollection.prototype.addAll = function (clauses) {
352
+ return this.y1l(clauses);
353
+ };
354
+ AbstractReteClauseCollection.prototype.z1l = function (clause) {
355
+ var newTheory = this.j1l_1.f1m();
356
+ var retracted = newTheory.a1m(clause);
357
+ return none(retracted) ? new Failure(this.x1l()) : new Success(this.e1m(newTheory), toList(retracted));
358
+ };
359
+ AbstractReteClauseCollection.prototype.retrieve = function (clause) {
360
+ return this.z1l(clause);
361
+ };
362
+ AbstractReteClauseCollection.prototype.b1m = function (clause) {
363
+ var newTheory = this.j1l_1.f1m();
364
+ var retracted = newTheory.c1m(clause);
365
+ return none(retracted) ? new Failure(this.x1l()) : new Success(this.e1m(newTheory), toList(retracted));
366
+ };
367
+ AbstractReteClauseCollection.prototype.retrieveAll = function (clause) {
368
+ return this.b1m(clause);
369
+ };
370
+ function Companion() {
371
+ Companion_instance = this;
372
+ }
373
+ Companion.prototype.empty = function (unificator) {
374
+ return this.ofIterable(unificator, emptyList());
375
+ };
376
+ Companion.prototype.of = function (unificator, clause) {
377
+ return this.ofIterable(unificator, asIterable_0(clause));
378
+ };
379
+ Companion.prototype.ofScopes = function (unificator, clause) {
380
+ var tmp$ret$2;
381
+ // Inline function 'kotlin.collections.map' call
382
+ var tmp$ret$1;
383
+ // Inline function 'kotlin.collections.mapTo' call
384
+ var tmp0_mapTo = ArrayList_init_$Create$(clause.length);
385
+ var indexedObject = clause;
386
+ var inductionVariable = 0;
387
+ var last = indexedObject.length;
388
+ while (inductionVariable < last) {
389
+ var item = indexedObject[inductionVariable];
390
+ inductionVariable = inductionVariable + 1 | 0;
391
+ var tmp$ret$0;
392
+ // Inline function 'it.unibo.tuprolog.collections.Companion.of.<anonymous>' call
393
+ tmp$ret$0 = Companion_getInstance().emptyWithFunction(item);
394
+ tmp0_mapTo.g(tmp$ret$0);
395
+ }
396
+ tmp$ret$1 = tmp0_mapTo;
397
+ tmp$ret$2 = tmp$ret$1;
398
+ return this.ofIterable(unificator, tmp$ret$2);
399
+ };
400
+ Companion.prototype.ofSequence = function (unificator, clauses) {
401
+ return this.ofIterable(unificator, asIterable(clauses));
402
+ };
403
+ Companion.prototype.ofIterable = function (unificator, clauses) {
404
+ return ReteClauseQueue_init_$Create$(unificator, clauses);
405
+ };
406
+ Companion.prototype.areEquals = function (queue1, queue2) {
407
+ return itemWiseEquals(queue1, queue2);
408
+ };
409
+ Companion.prototype.computeHashCode = function (queue) {
410
+ return itemWiseHashCode_0([getKClass(ClauseQueue), itemWiseHashCode(queue)]);
411
+ };
412
+ var Companion_instance;
413
+ function Companion_getInstance_7() {
414
+ if (Companion_instance == null)
415
+ new Companion();
416
+ return Companion_instance;
417
+ }
418
+ function ClauseQueue() {
419
+ Companion_getInstance_7();
420
+ }
421
+ function Companion_0() {
422
+ Companion_instance_0 = this;
423
+ }
424
+ Companion_0.prototype.empty = function (unificator) {
425
+ return this.ofIterable(unificator, emptyList());
426
+ };
427
+ Companion_0.prototype.of = function (unificator, clause) {
428
+ return this.ofIterable(unificator, asIterable_0(clause));
429
+ };
430
+ Companion_0.prototype.ofScopes = function (unificator, clause) {
431
+ var tmp$ret$2;
432
+ // Inline function 'kotlin.collections.map' call
433
+ var tmp$ret$1;
434
+ // Inline function 'kotlin.collections.mapTo' call
435
+ var tmp0_mapTo = ArrayList_init_$Create$(clause.length);
436
+ var indexedObject = clause;
437
+ var inductionVariable = 0;
438
+ var last = indexedObject.length;
439
+ while (inductionVariable < last) {
440
+ var item = indexedObject[inductionVariable];
441
+ inductionVariable = inductionVariable + 1 | 0;
442
+ var tmp$ret$0;
443
+ // Inline function 'it.unibo.tuprolog.collections.Companion.of.<anonymous>' call
444
+ tmp$ret$0 = Companion_getInstance().emptyWithFunction(item);
445
+ tmp0_mapTo.g(tmp$ret$0);
446
+ }
447
+ tmp$ret$1 = tmp0_mapTo;
448
+ tmp$ret$2 = tmp$ret$1;
449
+ return this.ofIterable(unificator, tmp$ret$2);
450
+ };
451
+ Companion_0.prototype.ofSequence = function (unificator, clauses) {
452
+ return this.ofIterable(unificator, asIterable(clauses));
453
+ };
454
+ Companion_0.prototype.ofIterable = function (unificator, clauses) {
455
+ return MutableReteClauseQueue_init_$Create$(unificator, clauses);
456
+ };
457
+ Companion_0.prototype.areEquals = function (queue1, queue2) {
458
+ return Companion_getInstance_7().areEquals(queue1, queue2);
459
+ };
460
+ Companion_0.prototype.computeHashCode = function (queue) {
461
+ return itemWiseHashCode_0([getKClass(MutableClauseQueue), itemWiseHashCode(queue)]);
462
+ };
463
+ var Companion_instance_0;
464
+ function Companion_getInstance_8() {
465
+ if (Companion_instance_0 == null)
466
+ new Companion_0();
467
+ return Companion_instance_0;
468
+ }
469
+ function MutableClauseQueue() {
470
+ Companion_getInstance_8();
471
+ }
472
+ function Success(collection, clauses) {
473
+ RetrieveResult.call(this);
474
+ this.k1m_1 = collection;
475
+ this.l1m_1 = clauses;
476
+ }
477
+ Success.prototype.m1m = function () {
478
+ return this.k1m_1;
479
+ };
480
+ Success.prototype.t1l = function () {
481
+ return this.l1m_1;
482
+ };
483
+ Success.prototype.q12 = function () {
484
+ return true;
485
+ };
486
+ Success.prototype.n1m = function () {
487
+ return first(this.l1m_1);
488
+ };
489
+ Success.prototype.toString = function () {
490
+ return 'Success(collection=' + this.k1m_1 + ', clauses=' + this.l1m_1 + ')';
491
+ };
492
+ Success.prototype.hashCode = function () {
493
+ var result = hashCode(this.k1m_1);
494
+ result = imul(result, 31) + hashCode(this.l1m_1) | 0;
495
+ return result;
496
+ };
497
+ Success.prototype.equals = function (other) {
498
+ if (this === other)
499
+ return true;
500
+ if (!(other instanceof Success))
501
+ return false;
502
+ var tmp0_other_with_cast = other instanceof Success ? other : THROW_CCE();
503
+ if (!equals(this.k1m_1, tmp0_other_with_cast.k1m_1))
504
+ return false;
505
+ if (!equals(this.l1m_1, tmp0_other_with_cast.l1m_1))
506
+ return false;
507
+ return true;
508
+ };
509
+ function Failure(collection) {
510
+ RetrieveResult.call(this);
511
+ this.p1m_1 = collection;
512
+ }
513
+ Failure.prototype.m1m = function () {
514
+ return this.p1m_1;
515
+ };
516
+ Failure.prototype.o1m = function () {
517
+ return true;
518
+ };
519
+ Failure.prototype.t1l = function () {
520
+ return null;
521
+ };
522
+ Failure.prototype.n1m = function () {
523
+ return null;
524
+ };
525
+ Failure.prototype.toString = function () {
526
+ return 'Failure(collection=' + this.p1m_1 + ')';
527
+ };
528
+ Failure.prototype.hashCode = function () {
529
+ return hashCode(this.p1m_1);
530
+ };
531
+ Failure.prototype.equals = function (other) {
532
+ if (this === other)
533
+ return true;
534
+ if (!(other instanceof Failure))
535
+ return false;
536
+ var tmp0_other_with_cast = other instanceof Failure ? other : THROW_CCE();
537
+ if (!equals(this.p1m_1, tmp0_other_with_cast.p1m_1))
538
+ return false;
539
+ return true;
540
+ };
541
+ function RetrieveResult() {
542
+ }
543
+ RetrieveResult.prototype.q12 = function () {
544
+ return false;
545
+ };
546
+ RetrieveResult.prototype.o1m = function () {
547
+ return false;
548
+ };
549
+ Object.defineProperty(RetrieveResult.prototype, 'collection', {
550
+ configurable: true,
551
+ get: function () {
552
+ return this.m1m();
553
+ }
554
+ });
555
+ Object.defineProperty(RetrieveResult.prototype, 'clauses', {
556
+ configurable: true,
557
+ get: function () {
558
+ return this.t1l();
559
+ }
560
+ });
561
+ Object.defineProperty(RetrieveResult.prototype, 'firstClause', {
562
+ configurable: true,
563
+ get: function () {
564
+ return this.n1m();
565
+ }
566
+ });
567
+ function MutableReteClauseQueue_init_$Init$(unificator, clauses, $this) {
568
+ MutableReteClauseQueue.call($this, Companion_getInstance_9().q1m(unificator, clauses));
569
+ TheoryUtils_getInstance().r1m(clauses);
570
+ return $this;
571
+ }
572
+ function MutableReteClauseQueue_init_$Create$(unificator, clauses) {
573
+ return MutableReteClauseQueue_init_$Init$(unificator, clauses, Object.create(MutableReteClauseQueue.prototype));
574
+ }
575
+ function MutableReteClauseQueue(rete) {
576
+ AbstractMutableReteClauseCollection.call(this, rete);
577
+ // Inline function 'kotlin.require' call
578
+ var tmp0_require = rete.s1m();
579
+ // Inline function 'kotlin.contracts.contract' call
580
+ // Inline function 'kotlin.require' call
581
+ // Inline function 'kotlin.contracts.contract' call
582
+ if (!tmp0_require) {
583
+ var tmp$ret$0;
584
+ // Inline function 'kotlin.require.<anonymous>' call
585
+ tmp$ret$0 = 'Failed requirement.';
586
+ var message = tmp$ret$0;
587
+ throw IllegalArgumentException_init_$Create$(toString(message));
588
+ }
589
+ }
590
+ MutableReteClauseQueue.prototype.u1m = function (clause) {
591
+ return this.j1l_1.r1l(clause);
592
+ };
593
+ MutableReteClauseQueue.prototype.getFifoOrdered = function (clause) {
594
+ return this.u1m(clause);
595
+ };
596
+ MutableReteClauseQueue.prototype.v1m = function (clause) {
597
+ return asSequence(asReversed(toList(this.u1m(clause))));
598
+ };
599
+ MutableReteClauseQueue.prototype.getLifoOrdered = function (clause) {
600
+ return this.v1m(clause);
601
+ };
602
+ MutableReteClauseQueue.prototype.h1m = function (clause) {
603
+ this.j1l_1.w1m(clause);
604
+ return this;
605
+ };
606
+ MutableReteClauseQueue.prototype.addFirst = function (clause) {
607
+ return this.h1m(clause);
608
+ };
609
+ MutableReteClauseQueue.prototype.i1m = function (clause) {
610
+ this.j1l_1.w1l(clause);
611
+ return this;
612
+ };
613
+ MutableReteClauseQueue.prototype.addLast = function (clause) {
614
+ return this.i1m(clause);
615
+ };
616
+ MutableReteClauseQueue.prototype.j1m = function (clause) {
617
+ var retracted = this.j1l_1.a1m(clause);
618
+ return none(retracted) ? new Failure(this) : new Success(this, toList(retracted));
619
+ };
620
+ MutableReteClauseQueue.prototype.retrieveFirst = function (clause) {
621
+ return this.j1m(clause);
622
+ };
623
+ MutableReteClauseQueue.prototype.equals = function (other) {
624
+ var tmp;
625
+ if (!(other == null) ? isInterface(other, MutableClauseQueue) : false) {
626
+ tmp = Companion_getInstance_8().areEquals(this, other);
627
+ } else {
628
+ tmp = false;
629
+ }
630
+ return tmp;
631
+ };
632
+ MutableReteClauseQueue.prototype.hashCode = function () {
633
+ return Companion_getInstance_8().computeHashCode(this);
634
+ };
635
+ MutableReteClauseQueue.prototype.x1l = function () {
636
+ return this;
637
+ };
638
+ function _get_hashCodeCache__ny3r0q($this) {
639
+ var tmp$ret$0;
640
+ // Inline function 'kotlin.getValue' call
641
+ var tmp0_getValue = hashCodeCache$factory();
642
+ tmp$ret$0 = $this.y1m_1.b1();
643
+ return tmp$ret$0;
644
+ }
645
+ function ReteClauseQueue_init_$Init$(unificator, clauses, $this) {
646
+ ReteClauseQueue.call($this, Companion_getInstance_9().q1m(unificator, clauses));
647
+ TheoryUtils_getInstance().r1m(clauses);
648
+ return $this;
649
+ }
650
+ function ReteClauseQueue_init_$Create$(unificator, clauses) {
651
+ return ReteClauseQueue_init_$Init$(unificator, clauses, Object.create(ReteClauseQueue.prototype));
652
+ }
653
+ function ReteClauseQueue$hashCodeCache$delegate$lambda(this$0) {
654
+ return function () {
655
+ return Companion_getInstance_7().computeHashCode(this$0);
656
+ };
657
+ }
658
+ function ReteClauseQueue(rete) {
659
+ AbstractReteClauseCollection.call(this, rete);
660
+ var tmp = this;
661
+ tmp.y1m_1 = lazy(ReteClauseQueue$hashCodeCache$delegate$lambda(this));
662
+ // Inline function 'kotlin.require' call
663
+ var tmp0_require = rete.s1m();
664
+ // Inline function 'kotlin.contracts.contract' call
665
+ // Inline function 'kotlin.require' call
666
+ // Inline function 'kotlin.contracts.contract' call
667
+ if (!tmp0_require) {
668
+ var tmp$ret$0;
669
+ // Inline function 'kotlin.require.<anonymous>' call
670
+ tmp$ret$0 = 'Failed requirement.';
671
+ var message = tmp$ret$0;
672
+ throw IllegalArgumentException_init_$Create$(toString(message));
673
+ }
674
+ }
675
+ ReteClauseQueue.prototype.h1m = function (clause) {
676
+ var tmp$ret$0;
677
+ // Inline function 'kotlin.apply' call
678
+ var tmp0_apply = this.j1l_1.f1m();
679
+ // Inline function 'kotlin.contracts.contract' call
680
+ // Inline function 'it.unibo.tuprolog.collections.impl.ReteClauseQueue.addFirst.<anonymous>' call
681
+ tmp0_apply.w1m(TheoryUtils_getInstance().g1m(clause));
682
+ tmp$ret$0 = tmp0_apply;
683
+ return new ReteClauseQueue(tmp$ret$0);
684
+ };
685
+ ReteClauseQueue.prototype.addFirst = function (clause) {
686
+ return this.h1m(clause);
687
+ };
688
+ ReteClauseQueue.prototype.i1m = function (clause) {
689
+ var tmp$ret$0;
690
+ // Inline function 'kotlin.apply' call
691
+ var tmp0_apply = this.j1l_1.f1m();
692
+ // Inline function 'kotlin.contracts.contract' call
693
+ // Inline function 'it.unibo.tuprolog.collections.impl.ReteClauseQueue.addLast.<anonymous>' call
694
+ tmp0_apply.w1l(TheoryUtils_getInstance().g1m(clause));
695
+ tmp$ret$0 = tmp0_apply;
696
+ return new ReteClauseQueue(tmp$ret$0);
697
+ };
698
+ ReteClauseQueue.prototype.addLast = function (clause) {
699
+ return this.i1m(clause);
700
+ };
701
+ ReteClauseQueue.prototype.u1m = function (clause) {
702
+ return this.j1l_1.r1l(clause);
703
+ };
704
+ ReteClauseQueue.prototype.getFifoOrdered = function (clause) {
705
+ return this.u1m(clause);
706
+ };
707
+ ReteClauseQueue.prototype.v1m = function (clause) {
708
+ return asSequence(asReversed(toList(this.u1m(clause))));
709
+ };
710
+ ReteClauseQueue.prototype.getLifoOrdered = function (clause) {
711
+ return this.v1m(clause);
712
+ };
713
+ ReteClauseQueue.prototype.v1l = function (clause) {
714
+ return this.i1m(clause);
715
+ };
716
+ ReteClauseQueue.prototype.add = function (clause) {
717
+ return this.v1l(clause);
718
+ };
719
+ ReteClauseQueue.prototype.z1l = function (clause) {
720
+ return AbstractReteClauseCollection.prototype.z1l.call(this, clause);
721
+ };
722
+ ReteClauseQueue.prototype.retrieve = function (clause) {
723
+ return this.z1l(clause);
724
+ };
725
+ ReteClauseQueue.prototype.j1m = function (clause) {
726
+ return AbstractReteClauseCollection.prototype.z1l.call(this, clause);
727
+ };
728
+ ReteClauseQueue.prototype.retrieveFirst = function (clause) {
729
+ return this.j1m(clause);
730
+ };
731
+ ReteClauseQueue.prototype.e1m = function (rete) {
732
+ return new ReteClauseQueue(rete);
733
+ };
734
+ ReteClauseQueue.prototype.equals = function (other) {
735
+ var tmp;
736
+ var tmp_0;
737
+ if (!(other == null) ? isInterface(other, ClauseQueue) : false) {
738
+ tmp_0 = !(!(other == null) ? isInterface(other, MutableClauseQueue) : false);
739
+ } else {
740
+ tmp_0 = false;
741
+ }
742
+ if (tmp_0) {
743
+ tmp = Companion_getInstance_7().areEquals(this, other);
744
+ } else {
745
+ tmp = false;
746
+ }
747
+ return tmp;
748
+ };
749
+ ReteClauseQueue.prototype.hashCode = function () {
750
+ return _get_hashCodeCache__ny3r0q(this);
751
+ };
752
+ ReteClauseQueue.prototype.x1l = function () {
753
+ return this;
754
+ };
755
+ function hashCodeCache$factory() {
756
+ return getPropertyCallableRef('hashCodeCache', 1, KProperty1, function (receiver) {
757
+ return _get_hashCodeCache__ny3r0q(receiver);
758
+ }, null);
759
+ }
760
+ function AbstractReteNode$removeAllLazily$slambda($source, this$0, $clause, resultContinuation) {
761
+ this.h1n_1 = $source;
762
+ this.i1n_1 = this$0;
763
+ this.j1n_1 = $clause;
764
+ CoroutineImpl.call(this, resultContinuation);
765
+ }
766
+ AbstractReteNode$removeAllLazily$slambda.prototype.pr = function ($this$sequence, $cont) {
767
+ var tmp = this.qr($this$sequence, $cont);
768
+ tmp.ei_1 = Unit_getInstance();
769
+ tmp.fi_1 = null;
770
+ return tmp.ki();
771
+ };
772
+ AbstractReteNode$removeAllLazily$slambda.prototype.wi = function (p1, $cont) {
773
+ return this.pr(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $cont);
774
+ };
775
+ AbstractReteNode$removeAllLazily$slambda.prototype.ki = function () {
776
+ var suspendResult = this.ei_1;
777
+ $sm: do
778
+ try {
779
+ var tmp = this.ci_1;
780
+ switch (tmp) {
781
+ case 0:
782
+ this.di_1 = 5;
783
+ this.l1n_1 = this.h1n_1.j();
784
+ this.ci_1 = 1;
785
+ continue $sm;
786
+ case 1:
787
+ if (!this.l1n_1.m()) {
788
+ this.ci_1 = 4;
789
+ continue $sm;
790
+ }
791
+
792
+ this.m1n_1 = this.l1n_1.p();
793
+ if (this.i1n_1.k1l().match(this.m1n_1.p1n(), this.j1n_1)) {
794
+ this.m1n_1.n1n();
795
+ this.l1n_1.u4();
796
+ this.ci_1 = 2;
797
+ suspendResult = this.k1n_1.z4(this.m1n_1, this);
798
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
799
+ return suspendResult;
800
+ }
801
+ continue $sm;
802
+ } else {
803
+ this.ci_1 = 3;
804
+ continue $sm;
805
+ }
806
+
807
+ break;
808
+ case 2:
809
+ this.ci_1 = 3;
810
+ continue $sm;
811
+ case 3:
812
+ this.ci_1 = 1;
813
+ continue $sm;
814
+ case 4:
815
+ return Unit_getInstance();
816
+ case 5:
817
+ throw this.fi_1;
818
+ }
819
+ } catch ($p) {
820
+ if (this.di_1 === 5) {
821
+ throw $p;
822
+ } else {
823
+ this.ci_1 = this.di_1;
824
+ this.fi_1 = $p;
825
+ }
826
+ }
827
+ while (true);
828
+ };
829
+ AbstractReteNode$removeAllLazily$slambda.prototype.qr = function ($this$sequence, completion) {
830
+ var i = new AbstractReteNode$removeAllLazily$slambda(this.h1n_1, this.i1n_1, this.j1n_1, completion);
831
+ i.k1n_1 = $this$sequence;
832
+ return i;
833
+ };
834
+ function AbstractReteNode$removeAllLazily$slambda_0($source, this$0, $clause, resultContinuation) {
835
+ var i = new AbstractReteNode$removeAllLazily$slambda($source, this$0, $clause, resultContinuation);
836
+ var l = function ($this$sequence, $cont) {
837
+ return i.pr($this$sequence, $cont);
838
+ };
839
+ l.$arity = 1;
840
+ return l;
841
+ }
842
+ function AbstractReteNode(unificator) {
843
+ this.o1n_1 = unificator;
844
+ }
845
+ AbstractReteNode.prototype.k1l = function () {
846
+ return this.o1n_1;
847
+ };
848
+ AbstractReteNode.prototype.q1n = function (source, clause) {
849
+ return sequence(AbstractReteNode$removeAllLazily$slambda_0(source, this, clause, null));
850
+ };
851
+ function Companion_1() {
852
+ Companion_instance_1 = this;
853
+ }
854
+ Companion_1.prototype.q1m = function (unificator, clauses) {
855
+ return new RootNode(unificator, clauses, true);
856
+ };
857
+ var Companion_instance_1;
858
+ function Companion_getInstance_9() {
859
+ if (Companion_instance_1 == null)
860
+ new Companion_1();
861
+ return Companion_instance_1;
862
+ }
863
+ function firstArguments(_this__u8e3s4, $this) {
864
+ return sequence(Utils$firstArguments$slambda_0(_this__u8e3s4, null));
865
+ }
866
+ function Utils$firstArguments$slambda($this_firstArguments, resultContinuation) {
867
+ this.c1o_1 = $this_firstArguments;
868
+ CoroutineImpl.call(this, resultContinuation);
869
+ }
870
+ Utils$firstArguments$slambda.prototype.f1o = function ($this$sequence, $cont) {
871
+ var tmp = this.g1o($this$sequence, $cont);
872
+ tmp.ei_1 = Unit_getInstance();
873
+ tmp.fi_1 = null;
874
+ return tmp.ki();
875
+ };
876
+ Utils$firstArguments$slambda.prototype.wi = function (p1, $cont) {
877
+ return this.f1o(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $cont);
878
+ };
879
+ Utils$firstArguments$slambda.prototype.ki = function () {
880
+ var suspendResult = this.ei_1;
881
+ $sm: do
882
+ try {
883
+ var tmp = this.ci_1;
884
+ switch (tmp) {
885
+ case 0:
886
+ this.di_1 = 5;
887
+ this.e1o_1 = this.c1o_1;
888
+ this.ci_1 = 1;
889
+ continue $sm;
890
+ case 1:
891
+ if (!this.e1o_1.lw()) {
892
+ this.ci_1 = 3;
893
+ continue $sm;
894
+ }
895
+
896
+ this.ci_1 = 2;
897
+ suspendResult = this.d1o_1.z4(this.e1o_1, this);
898
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
899
+ return suspendResult;
900
+ }
901
+
902
+ continue $sm;
903
+ case 2:
904
+ this.e1o_1 = this.e1o_1.castToStruct().getArgAt(0);
905
+ this.ci_1 = 1;
906
+ continue $sm;
907
+ case 3:
908
+ this.ci_1 = 4;
909
+ suspendResult = this.d1o_1.z4(this.e1o_1, this);
910
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
911
+ return suspendResult;
912
+ }
913
+
914
+ continue $sm;
915
+ case 4:
916
+ return Unit_getInstance();
917
+ case 5:
918
+ throw this.fi_1;
919
+ }
920
+ } catch ($p) {
921
+ if (this.di_1 === 5) {
922
+ throw $p;
923
+ } else {
924
+ this.ci_1 = this.di_1;
925
+ this.fi_1 = $p;
926
+ }
927
+ }
928
+ while (true);
929
+ };
930
+ Utils$firstArguments$slambda.prototype.g1o = function ($this$sequence, completion) {
931
+ var i = new Utils$firstArguments$slambda(this.c1o_1, completion);
932
+ i.d1o_1 = $this$sequence;
933
+ return i;
934
+ };
935
+ function Utils$firstArguments$slambda_0($this_firstArguments, resultContinuation) {
936
+ var i = new Utils$firstArguments$slambda($this_firstArguments, resultContinuation);
937
+ var l = function ($this$sequence, $cont) {
938
+ return i.f1o($this$sequence, $cont);
939
+ };
940
+ l.$arity = 1;
941
+ return l;
942
+ }
943
+ function SituatedIndexedClause$compareTo$ref() {
944
+ var l = function (p0, p1) {
945
+ return p0.zs(p1);
946
+ };
947
+ l.callableName = 'compareTo';
948
+ return l;
949
+ }
950
+ function Utils() {
951
+ Utils_instance = this;
952
+ }
953
+ Utils.prototype.h1o = function (_this__u8e3s4, nestingLevel) {
954
+ var tmp$ret$1;
955
+ // Inline function 'kotlin.let' call
956
+ var tmp0_let = takeFirstAfterSkipping(firstArguments(_this__u8e3s4, this), nestingLevel);
957
+ // Inline function 'kotlin.contracts.contract' call
958
+ var tmp$ret$0;
959
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.Utils.arityOfNestedFirstArgument.<anonymous>' call
960
+ tmp$ret$0 = tmp0_let.castToStruct().zv();
961
+ tmp$ret$1 = tmp$ret$0;
962
+ return tmp$ret$1;
963
+ };
964
+ Utils.prototype.i1o = function (_this__u8e3s4, nestingLevel) {
965
+ var tmp$ret$1;
966
+ // Inline function 'kotlin.let' call
967
+ var tmp0_let = takeFirstAfterSkipping(firstArguments(_this__u8e3s4, this), nestingLevel);
968
+ // Inline function 'kotlin.contracts.contract' call
969
+ var tmp$ret$0;
970
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.Utils.functorOfNestedFirstArgument.<anonymous>' call
971
+ tmp$ret$0 = tmp0_let.castToStruct().fw();
972
+ tmp$ret$1 = tmp$ret$0;
973
+ return tmp$ret$1;
974
+ };
975
+ Utils.prototype.j1o = function (_this__u8e3s4, nestingLevel) {
976
+ return takeFirstAfterSkipping(firstArguments(_this__u8e3s4, this), nestingLevel);
977
+ };
978
+ Utils.prototype.k1o = function (args) {
979
+ return this.l1o(listOf(args.slice()));
980
+ };
981
+ Utils.prototype.m1o = function (sequence) {
982
+ return this.l1o(asIterable(sequence));
983
+ };
984
+ Utils.prototype.l1o = function (iterable) {
985
+ return mergeSequences(iterable, SituatedIndexedClause$compareTo$ref());
986
+ };
987
+ Utils.prototype.n1o = function (args) {
988
+ return this.o1o(sequenceOf(args.slice()));
989
+ };
990
+ Utils.prototype.o1o = function (sequence) {
991
+ return flatten(sequence);
992
+ };
993
+ Utils.prototype.p1o = function (iterable) {
994
+ return this.o1o(asSequence(iterable));
995
+ };
996
+ Utils.prototype.q1o = function (args) {
997
+ return this.r1o(sequenceOf(args.slice()));
998
+ };
999
+ Utils.prototype.r1o = function (sequence) {
1000
+ return flatten(sequence);
1001
+ };
1002
+ Utils.prototype.s1o = function (a, b) {
1003
+ return (a == null ? b == null : false) ? null : a == null ? b : b == null ? a : a.zs(b) < 0 ? a : b;
1004
+ };
1005
+ var Utils_instance;
1006
+ function Utils_getInstance() {
1007
+ if (Utils_instance == null)
1008
+ new Utils();
1009
+ return Utils_instance;
1010
+ }
1011
+ function IndexedClause$Companion$wrap$1($traversed, $indexedClause) {
1012
+ this.u1o_1 = $indexedClause;
1013
+ this.t1o_1 = listOf($traversed.slice());
1014
+ }
1015
+ IndexedClause$Companion$wrap$1.prototype.yq = function () {
1016
+ return this.u1o_1.yq();
1017
+ };
1018
+ IndexedClause$Companion$wrap$1.prototype.b1 = function () {
1019
+ return this.u1o_1.b1();
1020
+ };
1021
+ IndexedClause$Companion$wrap$1.prototype.v1o = function () {
1022
+ return this.t1o_1;
1023
+ };
1024
+ IndexedClause$Companion$wrap$1.prototype.n1n = function () {
1025
+ // Inline function 'kotlin.collections.forEach' call
1026
+ var tmp0_forEach = this.t1o_1;
1027
+ var tmp0_iterator = tmp0_forEach.j();
1028
+ while (tmp0_iterator.m()) {
1029
+ var element = tmp0_iterator.p();
1030
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.clause.<no name provided>.invalidateAllCaches.<anonymous>' call
1031
+ element.t1n();
1032
+ }
1033
+ };
1034
+ IndexedClause$Companion$wrap$1.prototype.aa = function (other) {
1035
+ return this.zs((!(other == null) ? isInterface(other, LongIndexed) : false) ? other : THROW_CCE());
1036
+ };
1037
+ function Companion_2() {
1038
+ Companion_instance_2 = this;
1039
+ }
1040
+ Companion_2.prototype.x1o = function (indexedClause, traversed) {
1041
+ return new IndexedClause$Companion$wrap$1(traversed, indexedClause);
1042
+ };
1043
+ Companion_2.prototype.y1o = function (index, clause, traversed) {
1044
+ return this.x1o(Companion_getInstance_0().ys(index, clause), traversed.slice());
1045
+ };
1046
+ Companion_2.prototype.z1o = function (index, clause, traversed) {
1047
+ var tmp = Companion_getInstance_0().ys(index, clause);
1048
+ var tmp$ret$0;
1049
+ // Inline function 'kotlin.collections.toTypedArray' call
1050
+ tmp$ret$0 = copyToArray(traversed);
1051
+ return this.x1o(tmp, tmp$ret$0.slice());
1052
+ };
1053
+ var Companion_instance_2;
1054
+ function Companion_getInstance_10() {
1055
+ if (Companion_instance_2 == null)
1056
+ new Companion_2();
1057
+ return Companion_instance_2;
1058
+ }
1059
+ function IndexedClause() {
1060
+ }
1061
+ function SituatedIndexedClause$Companion$of$1($indexed, $index) {
1062
+ this.a1p_1 = $indexed;
1063
+ this.b1p_1 = $index;
1064
+ }
1065
+ SituatedIndexedClause$Companion$of$1.prototype.yq = function () {
1066
+ return this.a1p_1.yq();
1067
+ };
1068
+ SituatedIndexedClause$Companion$of$1.prototype.b1 = function () {
1069
+ return this.a1p_1.b1();
1070
+ };
1071
+ SituatedIndexedClause$Companion$of$1.prototype.c1p = function () {
1072
+ this.b1p_1.d1p(this);
1073
+ this.n1n();
1074
+ };
1075
+ SituatedIndexedClause$Companion$of$1.prototype.v1o = function () {
1076
+ return this.a1p_1.v1o();
1077
+ };
1078
+ SituatedIndexedClause$Companion$of$1.prototype.n1n = function () {
1079
+ this.a1p_1.n1n();
1080
+ };
1081
+ SituatedIndexedClause$Companion$of$1.prototype.equals = function (other) {
1082
+ if (this === other)
1083
+ return true;
1084
+ if (!(!(other == null) ? isInterface(other, SituatedIndexedClause) : false))
1085
+ return false;
1086
+ if (!this.yq().equals(other.yq()))
1087
+ return false;
1088
+ return true;
1089
+ };
1090
+ SituatedIndexedClause$Companion$of$1.prototype.aa = function (other) {
1091
+ return this.zs((!(other == null) ? isInterface(other, LongIndexed) : false) ? other : THROW_CCE());
1092
+ };
1093
+ function Companion_3() {
1094
+ Companion_instance_3 = this;
1095
+ }
1096
+ Companion_3.prototype.e1p = function (indexed, index) {
1097
+ return new SituatedIndexedClause$Companion$of$1(indexed, index);
1098
+ };
1099
+ var Companion_instance_3;
1100
+ function Companion_getInstance_11() {
1101
+ if (Companion_instance_3 == null)
1102
+ new Companion_3();
1103
+ return Companion_instance_3;
1104
+ }
1105
+ function SituatedIndexedClause() {
1106
+ }
1107
+ function AbstractIndexingLeaf(unificator) {
1108
+ AbstractReteNode.call(this, unificator);
1109
+ }
1110
+ AbstractIndexingLeaf.prototype.t1n = function () {
1111
+ };
1112
+ function extractFirst($this, clause) {
1113
+ var tmp$ret$3;
1114
+ // Inline function 'kotlin.collections.mapNotNull' call
1115
+ var tmp0_mapNotNull = $this.o1p_1.c3();
1116
+ var tmp$ret$2;
1117
+ // Inline function 'kotlin.collections.mapNotNullTo' call
1118
+ var tmp0_mapNotNullTo = ArrayList_init_$Create$_0();
1119
+ // Inline function 'kotlin.collections.forEach' call
1120
+ var tmp0_iterator = tmp0_mapNotNull.j();
1121
+ while (tmp0_iterator.m()) {
1122
+ var element = tmp0_iterator.p();
1123
+ // Inline function 'kotlin.collections.mapNotNullTo.<anonymous>' call
1124
+ var tmp$ret$0;
1125
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.AtomIndex.extractFirst.<anonymous>' call
1126
+ tmp$ret$0 = extractFirst_0($this, clause, element);
1127
+ var tmp0_safe_receiver = tmp$ret$0;
1128
+ if (tmp0_safe_receiver == null)
1129
+ null;
1130
+ else {
1131
+ var tmp$ret$1;
1132
+ // Inline function 'kotlin.let' call
1133
+ // Inline function 'kotlin.contracts.contract' call
1134
+ tmp0_mapNotNullTo.g(tmp0_safe_receiver);
1135
+ tmp$ret$1 = Unit_getInstance();
1136
+ }
1137
+ }
1138
+ tmp$ret$2 = tmp0_mapNotNullTo;
1139
+ tmp$ret$3 = tmp$ret$2;
1140
+ return minOrNull(tmp$ret$3);
1141
+ }
1142
+ function extractFirst_0($this, clause, index) {
1143
+ var tmp$ret$1;
1144
+ $l$block: {
1145
+ // Inline function 'kotlin.collections.indexOfFirst' call
1146
+ var index_0 = 0;
1147
+ var tmp0_iterator = index.j();
1148
+ while (tmp0_iterator.m()) {
1149
+ var item = tmp0_iterator.p();
1150
+ var tmp$ret$0;
1151
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.AtomIndex.extractFirst.<anonymous>' call
1152
+ tmp$ret$0 = $this.k1l().match(item.p1n(), clause);
1153
+ if (tmp$ret$0) {
1154
+ tmp$ret$1 = index_0;
1155
+ break $l$block;
1156
+ }
1157
+ var tmp1 = index_0;
1158
+ index_0 = tmp1 + 1 | 0;
1159
+ }
1160
+ tmp$ret$1 = -1;
1161
+ }
1162
+ var actualIndex = tmp$ret$1;
1163
+ return actualIndex === -1 ? null : index.n(actualIndex);
1164
+ }
1165
+ function nestedFirstArgument(_this__u8e3s4, $this) {
1166
+ return Utils_getInstance().j1o(ensureNotNull(_this__u8e3s4.ly()), $this.n1p_1 + 1 | 0);
1167
+ }
1168
+ function asInnerAtom(_this__u8e3s4, $this) {
1169
+ return nestedFirstArgument(_this__u8e3s4, $this).castToAtom();
1170
+ }
1171
+ function asInnerAtom_0(_this__u8e3s4, $this) {
1172
+ return nestedFirstArgument(_this__u8e3s4.p1n(), $this).castToAtom();
1173
+ }
1174
+ function asInnerAtom_1(_this__u8e3s4, $this) {
1175
+ return nestedFirstArgument(_this__u8e3s4.p1n(), $this).castToAtom();
1176
+ }
1177
+ function AtomIndex$_get_size_$lambda_ygjfwe(it) {
1178
+ return it.o();
1179
+ }
1180
+ function AtomIndex$getIndexed$lambda(this$0, $clause) {
1181
+ return function (it) {
1182
+ return this$0.k1l().match(it.p1n(), $clause);
1183
+ };
1184
+ }
1185
+ function AtomIndex$retractAllIndexed$lambda(this$0, $clause) {
1186
+ return function (it) {
1187
+ return this$0.q1n(it, $clause);
1188
+ };
1189
+ }
1190
+ function AtomIndex$getCache$lambda(it) {
1191
+ return asSequence(it);
1192
+ }
1193
+ function AtomIndex$extractGlobalIndexedSequence$lambda(this$0, $clause) {
1194
+ return function (it) {
1195
+ return this$0.k1l().match(it.p1n(), $clause);
1196
+ };
1197
+ }
1198
+ function AtomIndex(unificator, ordered, nestingLevel) {
1199
+ AbstractIndexingLeaf.call(this, unificator);
1200
+ this.m1p_1 = ordered;
1201
+ this.n1p_1 = nestingLevel;
1202
+ var tmp = this;
1203
+ var tmp$ret$0;
1204
+ // Inline function 'kotlin.collections.mutableMapOf' call
1205
+ tmp$ret$0 = LinkedHashMap_init_$Create$();
1206
+ tmp.o1p_1 = tmp$ret$0;
1207
+ }
1208
+ AtomIndex.prototype.o = function () {
1209
+ var tmp = asSequence(this.o1p_1.c3());
1210
+ return sum(map(tmp, AtomIndex$_get_size_$lambda_ygjfwe));
1211
+ };
1212
+ AtomIndex.prototype.o1l = function () {
1213
+ var tmp;
1214
+ if (this.o1p_1.d()) {
1215
+ tmp = true;
1216
+ } else {
1217
+ var tmp$ret$0;
1218
+ $l$block_0: {
1219
+ // Inline function 'kotlin.collections.all' call
1220
+ var tmp0_all = this.o1p_1.c3();
1221
+ var tmp_0;
1222
+ if (isInterface(tmp0_all, Collection)) {
1223
+ tmp_0 = tmp0_all.d();
1224
+ } else {
1225
+ tmp_0 = false;
1226
+ }
1227
+ if (tmp_0) {
1228
+ tmp$ret$0 = true;
1229
+ break $l$block_0;
1230
+ }
1231
+ var tmp0_iterator = tmp0_all.j();
1232
+ while (tmp0_iterator.m()) {
1233
+ var element = tmp0_iterator.p();
1234
+ var tmp$ret$1;
1235
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.AtomIndex.<get-isEmpty>.<anonymous>' call
1236
+ tmp$ret$1 = element.d();
1237
+ if (!tmp$ret$1) {
1238
+ tmp$ret$0 = false;
1239
+ break $l$block_0;
1240
+ }
1241
+ }
1242
+ tmp$ret$0 = true;
1243
+ }
1244
+ tmp = tmp$ret$0;
1245
+ }
1246
+ return tmp;
1247
+ };
1248
+ AtomIndex.prototype.r1n = function (clause) {
1249
+ if (this.m1p_1) {
1250
+ var tmp$ret$2;
1251
+ // Inline function 'kotlin.let' call
1252
+ var tmp0_let = asInnerAtom_1(clause, this);
1253
+ // Inline function 'kotlin.contracts.contract' call
1254
+ var tmp$ret$1;
1255
+ // Inline function 'kotlin.collections.getOrPut' call
1256
+ var tmp0_getOrPut = this.o1p_1;
1257
+ var value = tmp0_getOrPut.a3(tmp0_let);
1258
+ var tmp;
1259
+ if (value == null) {
1260
+ var tmp$ret$0;
1261
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.AtomIndex.assertA.<anonymous>.<anonymous>' call
1262
+ tmp$ret$0 = dequeOf([]);
1263
+ var answer = tmp$ret$0;
1264
+ tmp0_getOrPut.w3(tmp0_let, answer);
1265
+ tmp = answer;
1266
+ } else {
1267
+ tmp = value;
1268
+ }
1269
+ tmp$ret$1 = tmp;
1270
+ addFirst(tmp$ret$1, Companion_getInstance_11().e1p(clause.w1o(this), this));
1271
+ tmp$ret$2 = Unit_getInstance();
1272
+ } else {
1273
+ this.s1n(clause);
1274
+ }
1275
+ };
1276
+ AtomIndex.prototype.s1n = function (clause) {
1277
+ var tmp$ret$3;
1278
+ // Inline function 'kotlin.let' call
1279
+ var tmp0_let = asInnerAtom_1(clause, this);
1280
+ // Inline function 'kotlin.contracts.contract' call
1281
+ var tmp$ret$2;
1282
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.AtomIndex.assertZ.<anonymous>' call
1283
+ var tmp$ret$1;
1284
+ // Inline function 'kotlin.collections.getOrPut' call
1285
+ var tmp0_getOrPut = this.o1p_1;
1286
+ var value = tmp0_getOrPut.a3(tmp0_let);
1287
+ var tmp;
1288
+ if (value == null) {
1289
+ var tmp$ret$0;
1290
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.AtomIndex.assertZ.<anonymous>.<anonymous>' call
1291
+ tmp$ret$0 = dequeOf([]);
1292
+ var answer = tmp$ret$0;
1293
+ tmp0_getOrPut.w3(tmp0_let, answer);
1294
+ tmp = answer;
1295
+ } else {
1296
+ tmp = value;
1297
+ }
1298
+ tmp$ret$1 = tmp;
1299
+ tmp$ret$2 = tmp$ret$1.g(Companion_getInstance_11().e1p(clause.w1o(this), this));
1300
+ tmp$ret$3 = tmp$ret$2;
1301
+ };
1302
+ AtomIndex.prototype.g1p = function (clause) {
1303
+ var tmp;
1304
+ if (nestedFirstArgument(clause, this).aw()) {
1305
+ var tmp$ret$1;
1306
+ // Inline function 'kotlin.let' call
1307
+ var tmp0_let = this.o1p_1.a3(asInnerAtom(clause, this));
1308
+ // Inline function 'kotlin.contracts.contract' call
1309
+ var tmp$ret$0;
1310
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.AtomIndex.getFirstIndexed.<anonymous>' call
1311
+ var tmp_0;
1312
+ if (tmp0_let == null) {
1313
+ tmp_0 = null;
1314
+ } else {
1315
+ tmp_0 = extractFirst_0(this, clause, tmp0_let);
1316
+ }
1317
+ tmp$ret$0 = tmp_0;
1318
+ tmp$ret$1 = tmp$ret$0;
1319
+ tmp = tmp$ret$1;
1320
+ } else {
1321
+ tmp = extractFirst(this, clause);
1322
+ }
1323
+ return tmp;
1324
+ };
1325
+ AtomIndex.prototype.h1p = function (clause) {
1326
+ var tmp;
1327
+ if (nestedFirstArgument(clause, this).aw()) {
1328
+ var tmp0_safe_receiver = this.o1p_1.a3(asInnerAtom(clause, this));
1329
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : asSequence(tmp0_safe_receiver);
1330
+ var tmp_0;
1331
+ if (tmp1_safe_receiver == null) {
1332
+ tmp_0 = null;
1333
+ } else {
1334
+ tmp_0 = filter(tmp1_safe_receiver, AtomIndex$getIndexed$lambda(this, clause));
1335
+ }
1336
+ var tmp2_elvis_lhs = tmp_0;
1337
+ tmp = tmp2_elvis_lhs == null ? emptySequence() : tmp2_elvis_lhs;
1338
+ } else {
1339
+ tmp = this.j1p(clause);
1340
+ }
1341
+ return tmp;
1342
+ };
1343
+ AtomIndex.prototype.d1p = function (indexed) {
1344
+ ensureNotNull(this.o1p_1.a3(asInnerAtom_0(indexed, this))).ia(indexed);
1345
+ };
1346
+ AtomIndex.prototype.i1p = function (clause) {
1347
+ var tmp;
1348
+ if (nestedFirstArgument(clause, this).aw()) {
1349
+ var partialIndex = this.o1p_1.a3(asInnerAtom(clause, this));
1350
+ tmp = partialIndex == null ? emptySequence() : this.q1n(partialIndex, clause);
1351
+ } else {
1352
+ var tmp_0 = Utils_getInstance();
1353
+ var tmp_1 = asSequence(this.o1p_1.c3());
1354
+ tmp = tmp_0.m1o(map(tmp_1, AtomIndex$retractAllIndexed$lambda(this, clause)));
1355
+ }
1356
+ return buffered(tmp);
1357
+ };
1358
+ AtomIndex.prototype.k1p = function () {
1359
+ var tmp = Utils_getInstance();
1360
+ var tmp_0 = asSequence(this.o1p_1.c3());
1361
+ return tmp.m1o(map(tmp_0, AtomIndex$getCache$lambda));
1362
+ };
1363
+ AtomIndex.prototype.j1p = function (clause) {
1364
+ var tmp = this.k1p();
1365
+ return filter(tmp, AtomIndex$extractGlobalIndexedSequence$lambda(this, clause));
1366
+ };
1367
+ function nestedFunctor(_this__u8e3s4, $this) {
1368
+ return Utils_getInstance().i1o(ensureNotNull(_this__u8e3s4.ly()), $this.r1p_1);
1369
+ }
1370
+ function nestedFunctor_0(_this__u8e3s4, $this) {
1371
+ return Utils_getInstance().i1o(ensureNotNull(_this__u8e3s4.p1n().ly()), $this.r1p_1);
1372
+ }
1373
+ function isGlobal(_this__u8e3s4, $this) {
1374
+ return Utils_getInstance().j1o(ensureNotNull(_this__u8e3s4.ly()), $this.r1p_1).bx();
1375
+ }
1376
+ function regenerateCache($this) {
1377
+ var tmp;
1378
+ if ($this.q1p_1) {
1379
+ var tmp_0 = Utils_getInstance();
1380
+ var tmp$ret$2;
1381
+ // Inline function 'kotlin.collections.map' call
1382
+ var tmp0_map = $this.s1p_1.c3();
1383
+ var tmp$ret$1;
1384
+ // Inline function 'kotlin.collections.mapTo' call
1385
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
1386
+ var tmp0_iterator = tmp0_map.j();
1387
+ while (tmp0_iterator.m()) {
1388
+ var item = tmp0_iterator.p();
1389
+ var tmp$ret$0;
1390
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.regenerateCache.<anonymous>' call
1391
+ tmp$ret$0 = item.k1p();
1392
+ tmp0_mapTo.g(tmp$ret$0);
1393
+ }
1394
+ tmp$ret$1 = tmp0_mapTo;
1395
+ tmp$ret$2 = tmp$ret$1;
1396
+ tmp = tmp_0.l1o(tmp$ret$2);
1397
+ } else {
1398
+ var tmp_1 = Utils_getInstance();
1399
+ var tmp$ret$5;
1400
+ // Inline function 'kotlin.collections.map' call
1401
+ var tmp1_map = $this.s1p_1.c3();
1402
+ var tmp$ret$4;
1403
+ // Inline function 'kotlin.collections.mapTo' call
1404
+ var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
1405
+ var tmp0_iterator_0 = tmp1_map.j();
1406
+ while (tmp0_iterator_0.m()) {
1407
+ var item_0 = tmp0_iterator_0.p();
1408
+ var tmp$ret$3;
1409
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.regenerateCache.<anonymous>' call
1410
+ tmp$ret$3 = item_0.k1p();
1411
+ tmp0_mapTo_0.g(tmp$ret$3);
1412
+ }
1413
+ tmp$ret$4 = tmp0_mapTo_0;
1414
+ tmp$ret$5 = tmp$ret$4;
1415
+ tmp = tmp_1.p1o(tmp$ret$5);
1416
+ }
1417
+ return dequeOf_0(tmp);
1418
+ }
1419
+ function CompoundIndex$regenerateCache$ref($boundThis) {
1420
+ var l = function () {
1421
+ return regenerateCache($boundThis);
1422
+ };
1423
+ l.callableName = 'regenerateCache';
1424
+ return l;
1425
+ }
1426
+ function CompoundIndex$_get_size_$lambda_91vt0k(it) {
1427
+ return it.o();
1428
+ }
1429
+ function CompoundIndex(unificator, ordered, nestingLevel) {
1430
+ AbstractReteNode.call(this, unificator);
1431
+ this.q1p_1 = ordered;
1432
+ this.r1p_1 = nestingLevel;
1433
+ var tmp = this;
1434
+ var tmp$ret$0;
1435
+ // Inline function 'kotlin.collections.mutableMapOf' call
1436
+ tmp$ret$0 = LinkedHashMap_init_$Create$();
1437
+ tmp.s1p_1 = tmp$ret$0;
1438
+ var tmp_0 = this;
1439
+ var tmp_1 = Companion_getInstance_1();
1440
+ tmp_0.t1p_1 = tmp_1.kq(CompoundIndex$regenerateCache$ref(this));
1441
+ }
1442
+ CompoundIndex.prototype.o = function () {
1443
+ var tmp = asSequence(this.s1p_1.c3());
1444
+ return sum(map(tmp, CompoundIndex$_get_size_$lambda_91vt0k));
1445
+ };
1446
+ CompoundIndex.prototype.o1l = function () {
1447
+ var tmp;
1448
+ if (this.s1p_1.d()) {
1449
+ tmp = true;
1450
+ } else {
1451
+ var tmp$ret$0;
1452
+ $l$block_0: {
1453
+ // Inline function 'kotlin.collections.all' call
1454
+ var tmp0_all = this.s1p_1.c3();
1455
+ var tmp_0;
1456
+ if (isInterface(tmp0_all, Collection)) {
1457
+ tmp_0 = tmp0_all.d();
1458
+ } else {
1459
+ tmp_0 = false;
1460
+ }
1461
+ if (tmp_0) {
1462
+ tmp$ret$0 = true;
1463
+ break $l$block_0;
1464
+ }
1465
+ var tmp0_iterator = tmp0_all.j();
1466
+ while (tmp0_iterator.m()) {
1467
+ var element = tmp0_iterator.p();
1468
+ var tmp$ret$1;
1469
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.<get-isEmpty>.<anonymous>' call
1470
+ tmp$ret$1 = element.o1l();
1471
+ if (!tmp$ret$1) {
1472
+ tmp$ret$0 = false;
1473
+ break $l$block_0;
1474
+ }
1475
+ }
1476
+ tmp$ret$0 = true;
1477
+ }
1478
+ tmp = tmp$ret$0;
1479
+ }
1480
+ return tmp;
1481
+ };
1482
+ CompoundIndex.prototype.r1n = function (clause) {
1483
+ var tmp$ret$2;
1484
+ // Inline function 'kotlin.let' call
1485
+ var tmp0_let = nestedFunctor_0(clause, this);
1486
+ // Inline function 'kotlin.contracts.contract' call
1487
+ var tmp;
1488
+ if (this.q1p_1) {
1489
+ var tmp$ret$1;
1490
+ // Inline function 'kotlin.collections.getOrPut' call
1491
+ var tmp0_getOrPut = this.s1p_1;
1492
+ var value = tmp0_getOrPut.a3(tmp0_let);
1493
+ var tmp_0;
1494
+ if (value == null) {
1495
+ var tmp$ret$0;
1496
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.assertA.<anonymous>.<anonymous>' call
1497
+ tmp$ret$0 = new FunctorIndexingNode(this.k1l(), this.q1p_1, this.r1p_1);
1498
+ var answer = tmp$ret$0;
1499
+ tmp0_getOrPut.w3(tmp0_let, answer);
1500
+ tmp_0 = answer;
1501
+ } else {
1502
+ tmp_0 = value;
1503
+ }
1504
+ tmp$ret$1 = tmp_0;
1505
+ tmp$ret$1.r1n(clause.w1o(this));
1506
+ tmp = Unit_getInstance();
1507
+ } else {
1508
+ this.s1n(clause);
1509
+ tmp = Unit_getInstance();
1510
+ }
1511
+ tmp$ret$2 = tmp;
1512
+ return tmp$ret$2;
1513
+ };
1514
+ CompoundIndex.prototype.s1n = function (clause) {
1515
+ var tmp$ret$2;
1516
+ // Inline function 'kotlin.let' call
1517
+ var tmp0_let = nestedFunctor_0(clause, this);
1518
+ // Inline function 'kotlin.contracts.contract' call
1519
+ var tmp$ret$1;
1520
+ // Inline function 'kotlin.collections.getOrPut' call
1521
+ var tmp0_getOrPut = this.s1p_1;
1522
+ var value = tmp0_getOrPut.a3(tmp0_let);
1523
+ var tmp;
1524
+ if (value == null) {
1525
+ var tmp$ret$0;
1526
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.assertZ.<anonymous>.<anonymous>' call
1527
+ tmp$ret$0 = new FunctorIndexingNode(this.k1l(), this.q1p_1, this.r1p_1);
1528
+ var answer = tmp$ret$0;
1529
+ tmp0_getOrPut.w3(tmp0_let, answer);
1530
+ tmp = answer;
1531
+ } else {
1532
+ tmp = value;
1533
+ }
1534
+ tmp$ret$1 = tmp;
1535
+ tmp$ret$1.s1n(clause.w1o(this));
1536
+ tmp$ret$2 = Unit_getInstance();
1537
+ return tmp$ret$2;
1538
+ };
1539
+ CompoundIndex.prototype.k1p = function () {
1540
+ return asSequence(this.t1p_1.b1());
1541
+ };
1542
+ CompoundIndex.prototype.g1p = function (clause) {
1543
+ var tmp;
1544
+ if (isGlobal(clause, this)) {
1545
+ var tmp_0 = Utils_getInstance();
1546
+ var tmp$ret$3;
1547
+ // Inline function 'kotlin.collections.mapNotNull' call
1548
+ var tmp0_mapNotNull = this.s1p_1.c3();
1549
+ var tmp$ret$2;
1550
+ // Inline function 'kotlin.collections.mapNotNullTo' call
1551
+ var tmp0_mapNotNullTo = ArrayList_init_$Create$_0();
1552
+ // Inline function 'kotlin.collections.forEach' call
1553
+ var tmp0_iterator = tmp0_mapNotNull.j();
1554
+ while (tmp0_iterator.m()) {
1555
+ var element = tmp0_iterator.p();
1556
+ // Inline function 'kotlin.collections.mapNotNullTo.<anonymous>' call
1557
+ var tmp$ret$0;
1558
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.getFirstIndexed.<anonymous>' call
1559
+ tmp$ret$0 = element.g1p(clause);
1560
+ var tmp0_safe_receiver = tmp$ret$0;
1561
+ if (tmp0_safe_receiver == null)
1562
+ null;
1563
+ else {
1564
+ var tmp$ret$1;
1565
+ // Inline function 'kotlin.let' call
1566
+ // Inline function 'kotlin.contracts.contract' call
1567
+ tmp0_mapNotNullTo.g(tmp0_safe_receiver);
1568
+ tmp$ret$1 = Unit_getInstance();
1569
+ }
1570
+ }
1571
+ tmp$ret$2 = tmp0_mapNotNullTo;
1572
+ tmp$ret$3 = tmp$ret$2;
1573
+ tmp = firstOrNull(tmp_0.m1o(sequenceOf([asSequence(tmp$ret$3)])));
1574
+ } else {
1575
+ var tmp0_safe_receiver_0 = this.s1p_1.a3(nestedFunctor(clause, this));
1576
+ tmp = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.g1p(clause);
1577
+ }
1578
+ return tmp;
1579
+ };
1580
+ CompoundIndex.prototype.h1p = function (clause) {
1581
+ var tmp;
1582
+ if (isGlobal(clause, this)) {
1583
+ var tmp_0 = Utils_getInstance();
1584
+ var tmp$ret$2;
1585
+ // Inline function 'kotlin.collections.map' call
1586
+ var tmp0_map = this.s1p_1.c3();
1587
+ var tmp$ret$1;
1588
+ // Inline function 'kotlin.collections.mapTo' call
1589
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
1590
+ var tmp0_iterator = tmp0_map.j();
1591
+ while (tmp0_iterator.m()) {
1592
+ var item = tmp0_iterator.p();
1593
+ var tmp$ret$0;
1594
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.getIndexed.<anonymous>' call
1595
+ tmp$ret$0 = item.j1p(clause);
1596
+ tmp0_mapTo.g(tmp$ret$0);
1597
+ }
1598
+ tmp$ret$1 = tmp0_mapTo;
1599
+ tmp$ret$2 = tmp$ret$1;
1600
+ tmp = tmp_0.l1o(tmp$ret$2);
1601
+ } else {
1602
+ var tmp0_safe_receiver = this.s1p_1.a3(nestedFunctor(clause, this));
1603
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.h1p(clause);
1604
+ tmp = tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
1605
+ }
1606
+ return tmp;
1607
+ };
1608
+ CompoundIndex.prototype.i1p = function (clause) {
1609
+ var tmp;
1610
+ if (isGlobal(clause, this)) {
1611
+ var tmp_0 = Utils_getInstance();
1612
+ var tmp$ret$2;
1613
+ // Inline function 'kotlin.collections.map' call
1614
+ var tmp0_map = this.s1p_1.c3();
1615
+ var tmp$ret$1;
1616
+ // Inline function 'kotlin.collections.mapTo' call
1617
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
1618
+ var tmp0_iterator = tmp0_map.j();
1619
+ while (tmp0_iterator.m()) {
1620
+ var item = tmp0_iterator.p();
1621
+ var tmp$ret$0;
1622
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.retractAllIndexed.<anonymous>' call
1623
+ tmp$ret$0 = item.i1p(clause);
1624
+ tmp0_mapTo.g(tmp$ret$0);
1625
+ }
1626
+ tmp$ret$1 = tmp0_mapTo;
1627
+ tmp$ret$2 = tmp$ret$1;
1628
+ tmp = tmp_0.l1o(tmp$ret$2);
1629
+ } else {
1630
+ var tmp0_safe_receiver = this.s1p_1.a3(nestedFunctor(clause, this));
1631
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.i1p(clause);
1632
+ tmp = tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
1633
+ }
1634
+ return tmp;
1635
+ };
1636
+ CompoundIndex.prototype.j1p = function (clause) {
1637
+ var tmp;
1638
+ if (this.q1p_1) {
1639
+ var tmp_0 = Utils_getInstance();
1640
+ var tmp$ret$2;
1641
+ // Inline function 'kotlin.collections.map' call
1642
+ var tmp0_map = this.s1p_1.c3();
1643
+ var tmp$ret$1;
1644
+ // Inline function 'kotlin.collections.mapTo' call
1645
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
1646
+ var tmp0_iterator = tmp0_map.j();
1647
+ while (tmp0_iterator.m()) {
1648
+ var item = tmp0_iterator.p();
1649
+ var tmp$ret$0;
1650
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.extractGlobalIndexedSequence.<anonymous>' call
1651
+ tmp$ret$0 = item.j1p(clause);
1652
+ tmp0_mapTo.g(tmp$ret$0);
1653
+ }
1654
+ tmp$ret$1 = tmp0_mapTo;
1655
+ tmp$ret$2 = tmp$ret$1;
1656
+ tmp = tmp_0.l1o(tmp$ret$2);
1657
+ } else {
1658
+ var tmp_1 = Utils_getInstance();
1659
+ var tmp$ret$5;
1660
+ // Inline function 'kotlin.collections.map' call
1661
+ var tmp1_map = this.s1p_1.c3();
1662
+ var tmp$ret$4;
1663
+ // Inline function 'kotlin.collections.mapTo' call
1664
+ var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
1665
+ var tmp0_iterator_0 = tmp1_map.j();
1666
+ while (tmp0_iterator_0.m()) {
1667
+ var item_0 = tmp0_iterator_0.p();
1668
+ var tmp$ret$3;
1669
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.CompoundIndex.extractGlobalIndexedSequence.<anonymous>' call
1670
+ tmp$ret$3 = item_0.j1p(clause);
1671
+ tmp0_mapTo_0.g(tmp$ret$3);
1672
+ }
1673
+ tmp$ret$4 = tmp0_mapTo_0;
1674
+ tmp$ret$5 = tmp$ret$4;
1675
+ tmp = tmp_1.p1o(tmp$ret$5);
1676
+ }
1677
+ return tmp;
1678
+ };
1679
+ CompoundIndex.prototype.t1n = function () {
1680
+ this.t1p_1.mq();
1681
+ };
1682
+ function DirectiveIndex$retractFirst$lambda(it) {
1683
+ return it.p1n();
1684
+ }
1685
+ function DirectiveIndex$retractAll$lambda(it) {
1686
+ return it.p1n();
1687
+ }
1688
+ function DirectiveIndex$getCache$lambda(it) {
1689
+ var tmp = Companion_getInstance_11();
1690
+ return tmp.e1p(it, new DirectiveIndex$getCache$1$1());
1691
+ }
1692
+ function DirectiveIndex$getCache$1$1() {
1693
+ }
1694
+ DirectiveIndex$getCache$1$1.prototype.d1p = function (indexed) {
1695
+ // Inline function 'kotlin.TODO' call
1696
+ var tmp0_TODO = 'Directives are adapted as a SituatedIndexedClause, but they are not actually stored with this type. Given their particular semantic, try retracting directly with a proper query, or opening a pull request implementing this indexing class as a proper typed data structure';
1697
+ throw new NotImplementedError('An operation is not implemented: ' + tmp0_TODO);
1698
+ };
1699
+ function DirectiveIndex(unificator, ordered) {
1700
+ AbstractReteNode.call(this, unificator);
1701
+ this.v1p_1 = ordered;
1702
+ this.w1p_1 = dequeOf([]);
1703
+ }
1704
+ DirectiveIndex.prototype.o = function () {
1705
+ return this.w1p_1.o();
1706
+ };
1707
+ DirectiveIndex.prototype.o1l = function () {
1708
+ return this.w1p_1.d();
1709
+ };
1710
+ DirectiveIndex.prototype.r1l = function (clause) {
1711
+ var tmp$ret$5;
1712
+ // Inline function 'kotlin.collections.map' call
1713
+ var tmp$ret$2;
1714
+ // Inline function 'kotlin.collections.filter' call
1715
+ var tmp0_filter = this.w1p_1;
1716
+ var tmp$ret$1;
1717
+ // Inline function 'kotlin.collections.filterTo' call
1718
+ var tmp0_filterTo = ArrayList_init_$Create$_0();
1719
+ var tmp0_iterator = tmp0_filter.j();
1720
+ while (tmp0_iterator.m()) {
1721
+ var element = tmp0_iterator.p();
1722
+ var tmp$ret$0;
1723
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.DirectiveIndex.get.<anonymous>' call
1724
+ tmp$ret$0 = this.k1l().match(element.p1n(), clause);
1725
+ if (tmp$ret$0) {
1726
+ tmp0_filterTo.g(element);
1727
+ }
1728
+ }
1729
+ tmp$ret$1 = tmp0_filterTo;
1730
+ tmp$ret$2 = tmp$ret$1;
1731
+ var tmp1_map = tmp$ret$2;
1732
+ var tmp$ret$4;
1733
+ // Inline function 'kotlin.collections.mapTo' call
1734
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
1735
+ var tmp0_iterator_0 = tmp1_map.j();
1736
+ while (tmp0_iterator_0.m()) {
1737
+ var item = tmp0_iterator_0.p();
1738
+ var tmp$ret$3;
1739
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.DirectiveIndex.get.<anonymous>' call
1740
+ tmp$ret$3 = item.p1n();
1741
+ tmp0_mapTo.g(tmp$ret$3);
1742
+ }
1743
+ tmp$ret$4 = tmp0_mapTo;
1744
+ tmp$ret$5 = tmp$ret$4;
1745
+ return asSequence(tmp$ret$5);
1746
+ };
1747
+ DirectiveIndex.prototype.r1n = function (clause) {
1748
+ if (this.v1p_1) {
1749
+ addFirst(this.w1p_1, clause.w1o(this));
1750
+ } else {
1751
+ this.s1n(clause);
1752
+ }
1753
+ };
1754
+ DirectiveIndex.prototype.s1n = function (clause) {
1755
+ this.w1p_1.g(clause.w1o(this));
1756
+ };
1757
+ DirectiveIndex.prototype.a1m = function (clause) {
1758
+ var tmp = this.q1n(this.w1p_1, clause);
1759
+ return buffered(take(map(tmp, DirectiveIndex$retractFirst$lambda), 1));
1760
+ };
1761
+ DirectiveIndex.prototype.c1m = function (clause) {
1762
+ var tmp = this.q1n(this.w1p_1, clause);
1763
+ return buffered(map(tmp, DirectiveIndex$retractAll$lambda));
1764
+ };
1765
+ DirectiveIndex.prototype.k1p = function () {
1766
+ var tmp = asSequence(this.w1p_1);
1767
+ return map(tmp, DirectiveIndex$getCache$lambda);
1768
+ };
1769
+ DirectiveIndex.prototype.t1n = function () {
1770
+ };
1771
+ function extractFirst_1($this, clause) {
1772
+ var tmp$ret$3;
1773
+ // Inline function 'kotlin.collections.mapNotNull' call
1774
+ var tmp0_mapNotNull = $this.a1q_1.c3();
1775
+ var tmp$ret$2;
1776
+ // Inline function 'kotlin.collections.mapNotNullTo' call
1777
+ var tmp0_mapNotNullTo = ArrayList_init_$Create$_0();
1778
+ // Inline function 'kotlin.collections.forEach' call
1779
+ var tmp0_iterator = tmp0_mapNotNull.j();
1780
+ while (tmp0_iterator.m()) {
1781
+ var element = tmp0_iterator.p();
1782
+ // Inline function 'kotlin.collections.mapNotNullTo.<anonymous>' call
1783
+ var tmp$ret$0;
1784
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.NumericIndex.extractFirst.<anonymous>' call
1785
+ tmp$ret$0 = extractFirst_2($this, clause, element);
1786
+ var tmp0_safe_receiver = tmp$ret$0;
1787
+ if (tmp0_safe_receiver == null)
1788
+ null;
1789
+ else {
1790
+ var tmp$ret$1;
1791
+ // Inline function 'kotlin.let' call
1792
+ // Inline function 'kotlin.contracts.contract' call
1793
+ tmp0_mapNotNullTo.g(tmp0_safe_receiver);
1794
+ tmp$ret$1 = Unit_getInstance();
1795
+ }
1796
+ }
1797
+ tmp$ret$2 = tmp0_mapNotNullTo;
1798
+ tmp$ret$3 = tmp$ret$2;
1799
+ return minOrNull(tmp$ret$3);
1800
+ }
1801
+ function extractFirst_2($this, clause, index) {
1802
+ var tmp$ret$1;
1803
+ $l$block: {
1804
+ // Inline function 'kotlin.collections.indexOfFirst' call
1805
+ var index_0 = 0;
1806
+ var tmp0_iterator = index.j();
1807
+ while (tmp0_iterator.m()) {
1808
+ var item = tmp0_iterator.p();
1809
+ var tmp$ret$0;
1810
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.NumericIndex.extractFirst.<anonymous>' call
1811
+ tmp$ret$0 = $this.k1l().match(item.p1n(), clause);
1812
+ if (tmp$ret$0) {
1813
+ tmp$ret$1 = index_0;
1814
+ break $l$block;
1815
+ }
1816
+ var tmp1 = index_0;
1817
+ index_0 = tmp1 + 1 | 0;
1818
+ }
1819
+ tmp$ret$1 = -1;
1820
+ }
1821
+ var actualIndex = tmp$ret$1;
1822
+ var tmp;
1823
+ if (actualIndex === -1) {
1824
+ tmp = null;
1825
+ } else {
1826
+ tmp = index.n(actualIndex);
1827
+ }
1828
+ return tmp;
1829
+ }
1830
+ function nestedFirstArgument_0(_this__u8e3s4, $this) {
1831
+ return Utils_getInstance().j1o(ensureNotNull(_this__u8e3s4.ly()), $this.z1p_1 + 1 | 0);
1832
+ }
1833
+ function asInnerNumeric(_this__u8e3s4, $this) {
1834
+ return nestedFirstArgument_0(_this__u8e3s4, $this).castToNumeric();
1835
+ }
1836
+ function asInnerNumeric_0(_this__u8e3s4, $this) {
1837
+ return nestedFirstArgument_0(_this__u8e3s4.p1n(), $this).castToNumeric();
1838
+ }
1839
+ function asInnerNumeric_1(_this__u8e3s4, $this) {
1840
+ return nestedFirstArgument_0(_this__u8e3s4.p1n(), $this).castToNumeric();
1841
+ }
1842
+ function NumericIndex$_get_size_$lambda_exo30i(it) {
1843
+ return it.o();
1844
+ }
1845
+ function NumericIndex$getIndexed$lambda(this$0, $clause) {
1846
+ return function (it) {
1847
+ return this$0.k1l().match(it.p1n(), $clause);
1848
+ };
1849
+ }
1850
+ function NumericIndex$retractAllIndexed$lambda(this$0, $clause) {
1851
+ return function (it) {
1852
+ return this$0.q1n(it, $clause);
1853
+ };
1854
+ }
1855
+ function NumericIndex$getCache$lambda(it) {
1856
+ return asSequence(it);
1857
+ }
1858
+ function NumericIndex$extractGlobalIndexedSequence$lambda(this$0, $clause) {
1859
+ return function (it) {
1860
+ return this$0.k1l().match(it.p1n(), $clause);
1861
+ };
1862
+ }
1863
+ function NumericIndex(unificator, ordered, nestingLevel) {
1864
+ AbstractIndexingLeaf.call(this, unificator);
1865
+ this.y1p_1 = ordered;
1866
+ this.z1p_1 = nestingLevel;
1867
+ var tmp = this;
1868
+ var tmp$ret$0;
1869
+ // Inline function 'kotlin.collections.mutableMapOf' call
1870
+ tmp$ret$0 = LinkedHashMap_init_$Create$();
1871
+ tmp.a1q_1 = tmp$ret$0;
1872
+ }
1873
+ NumericIndex.prototype.o = function () {
1874
+ var tmp = asSequence(this.a1q_1.c3());
1875
+ return sum(map(tmp, NumericIndex$_get_size_$lambda_exo30i));
1876
+ };
1877
+ NumericIndex.prototype.o1l = function () {
1878
+ var tmp;
1879
+ if (this.a1q_1.d()) {
1880
+ tmp = true;
1881
+ } else {
1882
+ var tmp$ret$0;
1883
+ $l$block_0: {
1884
+ // Inline function 'kotlin.collections.all' call
1885
+ var tmp0_all = this.a1q_1.c3();
1886
+ var tmp_0;
1887
+ if (isInterface(tmp0_all, Collection)) {
1888
+ tmp_0 = tmp0_all.d();
1889
+ } else {
1890
+ tmp_0 = false;
1891
+ }
1892
+ if (tmp_0) {
1893
+ tmp$ret$0 = true;
1894
+ break $l$block_0;
1895
+ }
1896
+ var tmp0_iterator = tmp0_all.j();
1897
+ while (tmp0_iterator.m()) {
1898
+ var element = tmp0_iterator.p();
1899
+ var tmp$ret$1;
1900
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.NumericIndex.<get-isEmpty>.<anonymous>' call
1901
+ tmp$ret$1 = element.d();
1902
+ if (!tmp$ret$1) {
1903
+ tmp$ret$0 = false;
1904
+ break $l$block_0;
1905
+ }
1906
+ }
1907
+ tmp$ret$0 = true;
1908
+ }
1909
+ tmp = tmp$ret$0;
1910
+ }
1911
+ return tmp;
1912
+ };
1913
+ NumericIndex.prototype.r1n = function (clause) {
1914
+ if (this.y1p_1) {
1915
+ var tmp$ret$2;
1916
+ // Inline function 'kotlin.let' call
1917
+ var tmp0_let = asInnerNumeric_1(clause, this);
1918
+ // Inline function 'kotlin.contracts.contract' call
1919
+ var tmp$ret$1;
1920
+ // Inline function 'kotlin.collections.getOrPut' call
1921
+ var tmp0_getOrPut = this.a1q_1;
1922
+ var value = tmp0_getOrPut.a3(tmp0_let);
1923
+ var tmp;
1924
+ if (value == null) {
1925
+ var tmp$ret$0;
1926
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.NumericIndex.assertA.<anonymous>.<anonymous>' call
1927
+ tmp$ret$0 = dequeOf([]);
1928
+ var answer = tmp$ret$0;
1929
+ tmp0_getOrPut.w3(tmp0_let, answer);
1930
+ tmp = answer;
1931
+ } else {
1932
+ tmp = value;
1933
+ }
1934
+ tmp$ret$1 = tmp;
1935
+ addFirst(tmp$ret$1, Companion_getInstance_11().e1p(clause.w1o(this), this));
1936
+ tmp$ret$2 = Unit_getInstance();
1937
+ } else {
1938
+ this.s1n(clause);
1939
+ }
1940
+ };
1941
+ NumericIndex.prototype.s1n = function (clause) {
1942
+ var tmp$ret$3;
1943
+ // Inline function 'kotlin.let' call
1944
+ var tmp0_let = asInnerNumeric_1(clause, this);
1945
+ // Inline function 'kotlin.contracts.contract' call
1946
+ var tmp$ret$2;
1947
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.NumericIndex.assertZ.<anonymous>' call
1948
+ var tmp$ret$1;
1949
+ // Inline function 'kotlin.collections.getOrPut' call
1950
+ var tmp0_getOrPut = this.a1q_1;
1951
+ var value = tmp0_getOrPut.a3(tmp0_let);
1952
+ var tmp;
1953
+ if (value == null) {
1954
+ var tmp$ret$0;
1955
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.NumericIndex.assertZ.<anonymous>.<anonymous>' call
1956
+ tmp$ret$0 = dequeOf([]);
1957
+ var answer = tmp$ret$0;
1958
+ tmp0_getOrPut.w3(tmp0_let, answer);
1959
+ tmp = answer;
1960
+ } else {
1961
+ tmp = value;
1962
+ }
1963
+ tmp$ret$1 = tmp;
1964
+ tmp$ret$2 = tmp$ret$1.g(Companion_getInstance_11().e1p(clause.w1o(this), this));
1965
+ tmp$ret$3 = tmp$ret$2;
1966
+ };
1967
+ NumericIndex.prototype.g1p = function (clause) {
1968
+ if (nestedFirstArgument_0(clause, this).fx()) {
1969
+ var tmp$ret$0;
1970
+ // Inline function 'kotlin.let' call
1971
+ var tmp0_let = this.a1q_1.a3(asInnerNumeric(clause, this));
1972
+ // Inline function 'kotlin.contracts.contract' call
1973
+ return tmp0_let == null ? null : extractFirst_2(this, clause, tmp0_let);
1974
+ } else {
1975
+ return extractFirst_1(this, clause);
1976
+ }
1977
+ };
1978
+ NumericIndex.prototype.h1p = function (clause) {
1979
+ var tmp;
1980
+ if (nestedFirstArgument_0(clause, this).fx()) {
1981
+ var tmp0_safe_receiver = this.a1q_1.a3(asInnerNumeric(clause, this));
1982
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : asSequence(tmp0_safe_receiver);
1983
+ var tmp_0;
1984
+ if (tmp1_safe_receiver == null) {
1985
+ tmp_0 = null;
1986
+ } else {
1987
+ tmp_0 = filter(tmp1_safe_receiver, NumericIndex$getIndexed$lambda(this, clause));
1988
+ }
1989
+ var tmp2_elvis_lhs = tmp_0;
1990
+ tmp = tmp2_elvis_lhs == null ? emptySequence() : tmp2_elvis_lhs;
1991
+ } else {
1992
+ tmp = this.j1p(clause);
1993
+ }
1994
+ return tmp;
1995
+ };
1996
+ NumericIndex.prototype.d1p = function (indexed) {
1997
+ ensureNotNull(this.a1q_1.a3(asInnerNumeric_0(indexed, this))).ia(indexed);
1998
+ };
1999
+ NumericIndex.prototype.i1p = function (clause) {
2000
+ var tmp;
2001
+ if (nestedFirstArgument_0(clause, this).fx()) {
2002
+ var partialIndex = this.a1q_1.a3(asInnerNumeric(clause, this));
2003
+ tmp = partialIndex == null ? emptySequence() : buffered(this.q1n(partialIndex, clause));
2004
+ } else {
2005
+ var tmp_0 = Utils_getInstance();
2006
+ var tmp_1 = asSequence(this.a1q_1.c3());
2007
+ tmp = buffered(tmp_0.m1o(map(tmp_1, NumericIndex$retractAllIndexed$lambda(this, clause))));
2008
+ }
2009
+ return tmp;
2010
+ };
2011
+ NumericIndex.prototype.k1p = function () {
2012
+ var tmp = Utils_getInstance();
2013
+ var tmp_0 = asSequence(this.a1q_1.c3());
2014
+ return tmp.m1o(map(tmp_0, NumericIndex$getCache$lambda));
2015
+ };
2016
+ NumericIndex.prototype.j1p = function (clause) {
2017
+ var tmp = this.k1p();
2018
+ return filter(tmp, NumericIndex$extractGlobalIndexedSequence$lambda(this, clause));
2019
+ };
2020
+ function extractFirst_3($this, clause, index) {
2021
+ var tmp$ret$1;
2022
+ $l$block: {
2023
+ // Inline function 'kotlin.collections.indexOfFirst' call
2024
+ var index_0 = 0;
2025
+ var tmp0_iterator = index.j();
2026
+ while (tmp0_iterator.m()) {
2027
+ var item = tmp0_iterator.p();
2028
+ var tmp$ret$0;
2029
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.leaf.VariableIndex.extractFirst.<anonymous>' call
2030
+ tmp$ret$0 = $this.k1l().match(item.p1n(), clause);
2031
+ if (tmp$ret$0) {
2032
+ tmp$ret$1 = index_0;
2033
+ break $l$block;
2034
+ }
2035
+ var tmp1 = index_0;
2036
+ index_0 = tmp1 + 1 | 0;
2037
+ }
2038
+ tmp$ret$1 = -1;
2039
+ }
2040
+ var actualIndex = tmp$ret$1;
2041
+ var tmp;
2042
+ if (actualIndex === -1) {
2043
+ tmp = null;
2044
+ } else {
2045
+ tmp = index.n(actualIndex);
2046
+ }
2047
+ return tmp;
2048
+ }
2049
+ function VariableIndex$extractGlobalIndexedSequence$lambda(this$0, $clause) {
2050
+ return function (it) {
2051
+ return this$0.k1l().match(it.p1n(), $clause);
2052
+ };
2053
+ }
2054
+ function VariableIndex(unificator, ordered) {
2055
+ AbstractIndexingLeaf.call(this, unificator);
2056
+ this.c1q_1 = ordered;
2057
+ this.d1q_1 = dequeOf([]);
2058
+ }
2059
+ VariableIndex.prototype.o = function () {
2060
+ return this.d1q_1.o();
2061
+ };
2062
+ VariableIndex.prototype.o1l = function () {
2063
+ return this.d1q_1.d();
2064
+ };
2065
+ VariableIndex.prototype.r1n = function (clause) {
2066
+ var tmp;
2067
+ if (this.c1q_1) {
2068
+ addFirst(this.d1q_1, Companion_getInstance_11().e1p(clause.w1o(this), this));
2069
+ tmp = Unit_getInstance();
2070
+ } else {
2071
+ this.s1n(clause);
2072
+ tmp = Unit_getInstance();
2073
+ }
2074
+ return tmp;
2075
+ };
2076
+ VariableIndex.prototype.s1n = function (clause) {
2077
+ this.d1q_1.g(Companion_getInstance_11().e1p(clause.w1o(this), this));
2078
+ };
2079
+ VariableIndex.prototype.k1p = function () {
2080
+ return asSequence(this.d1q_1);
2081
+ };
2082
+ VariableIndex.prototype.g1p = function (clause) {
2083
+ return extractFirst_3(this, clause, this.d1q_1);
2084
+ };
2085
+ VariableIndex.prototype.h1p = function (clause) {
2086
+ return this.j1p(clause);
2087
+ };
2088
+ VariableIndex.prototype.d1p = function (indexed) {
2089
+ this.d1q_1.ia(indexed);
2090
+ };
2091
+ VariableIndex.prototype.i1p = function (clause) {
2092
+ return buffered(this.q1n(this.d1q_1, clause));
2093
+ };
2094
+ VariableIndex.prototype.j1p = function (clause) {
2095
+ var tmp = asSequence(this.d1q_1);
2096
+ return filter(tmp, VariableIndex$extractGlobalIndexedSequence$lambda(this, clause));
2097
+ };
2098
+ function ArityNode(unificator) {
2099
+ AbstractReteNode.call(this, unificator);
2100
+ }
2101
+ function FamilyArityIndexingNode(unificator, ordered, nestingLevel) {
2102
+ FamilyArityReteNode.call(this, unificator, ordered, nestingLevel);
2103
+ this.m1q_1 = ordered;
2104
+ }
2105
+ FamilyArityIndexingNode.prototype.g1p = function (clause) {
2106
+ return this.m1q_1 ? this.w1q(clause) : this.v1q(clause);
2107
+ };
2108
+ FamilyArityIndexingNode.prototype.h1p = function (clause) {
2109
+ return this.m1q_1 ? this.y1q(clause) : this.x1q(clause);
2110
+ };
2111
+ FamilyArityIndexingNode.prototype.i1p = function (clause) {
2112
+ var tmp;
2113
+ if (this.m1q_1) {
2114
+ tmp = this.a1r(clause);
2115
+ } else {
2116
+ tmp = this.z1q(clause);
2117
+ }
2118
+ return tmp;
2119
+ };
2120
+ FamilyArityIndexingNode.prototype.j1p = function (clause) {
2121
+ var tmp;
2122
+ if (this.m1q_1) {
2123
+ tmp = Utils_getInstance().k1o([this.r1q_1.j1p(clause), this.q1q_1.j1p(clause), this.s1q_1.j1p(clause), this.t1q_1.j1p(clause)]);
2124
+ } else {
2125
+ tmp = Utils_getInstance().n1o([this.r1q_1.j1p(clause), this.q1q_1.j1p(clause), this.s1q_1.j1p(clause), this.t1q_1.j1p(clause)]);
2126
+ }
2127
+ return tmp;
2128
+ };
2129
+ function retractAllOrdered($this, clause) {
2130
+ var tmp = $this.a1r(clause);
2131
+ return map(tmp, FamilyArityReteNode$retractAllOrdered$lambda);
2132
+ }
2133
+ function getOrdered($this, clause) {
2134
+ var tmp = $this.y1q(clause);
2135
+ return map(tmp, FamilyArityReteNode$getOrdered$lambda);
2136
+ }
2137
+ function retractAllUnordered($this, clause) {
2138
+ var tmp = $this.z1q(clause);
2139
+ return map(tmp, FamilyArityReteNode$retractAllUnordered$lambda);
2140
+ }
2141
+ function getUnordered($this, clause) {
2142
+ var tmp = $this.x1q(clause);
2143
+ return map(tmp, FamilyArityReteNode$getUnordered$lambda);
2144
+ }
2145
+ function regenerateCache_0($this) {
2146
+ var tmp;
2147
+ if ($this.o1q_1) {
2148
+ tmp = Utils_getInstance().k1o([$this.r1q_1.k1p(), $this.q1q_1.k1p(), $this.s1q_1.k1p(), $this.t1q_1.k1p()]);
2149
+ } else {
2150
+ tmp = Utils_getInstance().n1o([$this.r1q_1.k1p(), $this.q1q_1.k1p(), $this.s1q_1.k1p(), $this.t1q_1.k1p()]);
2151
+ }
2152
+ return dequeOf_0(tmp);
2153
+ }
2154
+ function nestedFirstArgument_1(_this__u8e3s4, $this) {
2155
+ return Utils_getInstance().j1o(ensureNotNull(_this__u8e3s4.ly()), $this.p1q_1 + 1 | 0);
2156
+ }
2157
+ function assertByFirstParameter($this, clause) {
2158
+ var innerFirst = nestedFirstArgument_1(clause.p1n(), $this);
2159
+ return innerFirst.fx() ? $this.q1q_1 : innerFirst.aw() ? $this.r1q_1 : innerFirst.bx() ? $this.s1q_1 : $this.t1q_1;
2160
+ }
2161
+ function isGlobal_0(_this__u8e3s4, $this) {
2162
+ return Utils_getInstance().j1o(ensureNotNull(_this__u8e3s4.ly()), $this.p1q_1 + 1 | 0).bx();
2163
+ }
2164
+ function FamilyArityReteNode$regenerateCache$ref($boundThis) {
2165
+ var l = function () {
2166
+ return regenerateCache_0($boundThis);
2167
+ };
2168
+ l.callableName = 'regenerateCache';
2169
+ return l;
2170
+ }
2171
+ function FamilyArityReteNode$_get_size_$lambda_sxz8zo(it) {
2172
+ return it.o();
2173
+ }
2174
+ function FamilyArityReteNode$get$lambda(it) {
2175
+ return it.p1n();
2176
+ }
2177
+ function FamilyArityReteNode$get$lambda_0(it) {
2178
+ return it.p1n();
2179
+ }
2180
+ function FamilyArityReteNode$retractAllOrdered$lambda(it) {
2181
+ return it.p1n();
2182
+ }
2183
+ function FamilyArityReteNode$getOrdered$lambda(it) {
2184
+ return it.p1n();
2185
+ }
2186
+ function FamilyArityReteNode$retractAllUnordered$lambda(it) {
2187
+ return it.p1n();
2188
+ }
2189
+ function FamilyArityReteNode$getUnordered$lambda(it) {
2190
+ return it.p1n();
2191
+ }
2192
+ function FamilyArityReteNode(unificator, ordered, nestingLevel) {
2193
+ ArityNode.call(this, unificator);
2194
+ this.o1q_1 = ordered;
2195
+ this.p1q_1 = nestingLevel;
2196
+ this.q1q_1 = new NumericIndex(unificator, this.o1q_1, this.p1q_1);
2197
+ this.r1q_1 = new AtomIndex(unificator, this.o1q_1, this.p1q_1);
2198
+ this.s1q_1 = new VariableIndex(unificator, this.o1q_1);
2199
+ this.t1q_1 = new CompoundIndex(unificator, this.o1q_1, this.p1q_1 + 1 | 0);
2200
+ var tmp = this;
2201
+ var tmp_0 = Companion_getInstance_1();
2202
+ tmp.u1q_1 = tmp_0.kq(FamilyArityReteNode$regenerateCache$ref(this));
2203
+ }
2204
+ FamilyArityReteNode.prototype.a1m = function (clause) {
2205
+ var tmp;
2206
+ if (this.o1q_1) {
2207
+ tmp = this.w1q(clause);
2208
+ } else {
2209
+ tmp = this.v1q(clause);
2210
+ }
2211
+ var result = tmp;
2212
+ var tmp_0;
2213
+ if (result == null) {
2214
+ tmp_0 = emptySequence();
2215
+ } else {
2216
+ result.c1p();
2217
+ this.t1n();
2218
+ tmp_0 = sequenceOf([result.p1n()]);
2219
+ }
2220
+ return tmp_0;
2221
+ };
2222
+ FamilyArityReteNode.prototype.o = function () {
2223
+ var tmp = sequenceOf([this.q1q_1, this.r1q_1, this.s1q_1, this.t1q_1]);
2224
+ return sum(map(tmp, FamilyArityReteNode$_get_size_$lambda_sxz8zo));
2225
+ };
2226
+ FamilyArityReteNode.prototype.o1l = function () {
2227
+ var tmp$ret$1;
2228
+ $l$block: {
2229
+ // Inline function 'kotlin.sequences.all' call
2230
+ var tmp0_all = sequenceOf([this.q1q_1, this.r1q_1, this.s1q_1, this.t1q_1]);
2231
+ var tmp0_iterator = tmp0_all.j();
2232
+ while (tmp0_iterator.m()) {
2233
+ var element = tmp0_iterator.p();
2234
+ var tmp$ret$0;
2235
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FamilyArityReteNode.<get-isEmpty>.<anonymous>' call
2236
+ tmp$ret$0 = element.o1l();
2237
+ if (!tmp$ret$0) {
2238
+ tmp$ret$1 = false;
2239
+ break $l$block;
2240
+ }
2241
+ }
2242
+ tmp$ret$1 = true;
2243
+ }
2244
+ return tmp$ret$1;
2245
+ };
2246
+ FamilyArityReteNode.prototype.r1l = function (clause) {
2247
+ var tmp;
2248
+ if (isGlobal_0(clause, this)) {
2249
+ var tmp_0;
2250
+ if (this.o1q_1) {
2251
+ var tmp_1 = Utils_getInstance().k1o([this.r1q_1.j1p(clause), this.s1q_1.j1p(clause), this.q1q_1.j1p(clause), this.t1q_1.j1p(clause)]);
2252
+ tmp_0 = map(tmp_1, FamilyArityReteNode$get$lambda);
2253
+ } else {
2254
+ var tmp_2 = Utils_getInstance().n1o([this.r1q_1.j1p(clause), this.s1q_1.j1p(clause), this.q1q_1.j1p(clause), this.t1q_1.j1p(clause)]);
2255
+ tmp_0 = map(tmp_2, FamilyArityReteNode$get$lambda_0);
2256
+ }
2257
+ tmp = tmp_0;
2258
+ } else {
2259
+ tmp = this.o1q_1 ? getOrdered(this, clause) : getUnordered(this, clause);
2260
+ }
2261
+ return tmp;
2262
+ };
2263
+ FamilyArityReteNode.prototype.r1n = function (clause) {
2264
+ return assertByFirstParameter(this, clause).r1n(clause.w1o(this));
2265
+ };
2266
+ FamilyArityReteNode.prototype.s1n = function (clause) {
2267
+ return assertByFirstParameter(this, clause).s1n(clause.w1o(this));
2268
+ };
2269
+ FamilyArityReteNode.prototype.c1m = function (clause) {
2270
+ var tmp;
2271
+ if (this.o1q_1) {
2272
+ tmp = retractAllOrdered(this, clause);
2273
+ } else {
2274
+ tmp = retractAllUnordered(this, clause);
2275
+ }
2276
+ return tmp;
2277
+ };
2278
+ FamilyArityReteNode.prototype.k1p = function () {
2279
+ return asSequence(this.u1q_1.b1());
2280
+ };
2281
+ FamilyArityReteNode.prototype.a1r = function (clause) {
2282
+ var innerFirst = nestedFirstArgument_1(clause, this);
2283
+ var tmp;
2284
+ if (innerFirst.fx()) {
2285
+ tmp = Utils_getInstance().k1o([this.s1q_1.i1p(clause), this.q1q_1.i1p(clause)]);
2286
+ } else if (innerFirst.aw()) {
2287
+ tmp = Utils_getInstance().k1o([this.s1q_1.i1p(clause), this.r1q_1.i1p(clause)]);
2288
+ } else if (innerFirst.bx()) {
2289
+ tmp = Utils_getInstance().k1o([this.s1q_1.i1p(clause), this.q1q_1.i1p(clause), this.r1q_1.i1p(clause), this.t1q_1.i1p(clause)]);
2290
+ } else {
2291
+ tmp = Utils_getInstance().k1o([this.s1q_1.i1p(clause), this.t1q_1.i1p(clause)]);
2292
+ }
2293
+ return tmp;
2294
+ };
2295
+ FamilyArityReteNode.prototype.z1q = function (clause) {
2296
+ var innerFirst = nestedFirstArgument_1(clause, this);
2297
+ return innerFirst.fx() ? Utils_getInstance().n1o([this.s1q_1.i1p(clause), this.q1q_1.i1p(clause)]) : innerFirst.aw() ? Utils_getInstance().n1o([this.s1q_1.i1p(clause), this.r1q_1.i1p(clause)]) : innerFirst.bx() ? Utils_getInstance().n1o([this.s1q_1.i1p(clause), this.q1q_1.i1p(clause), this.r1q_1.i1p(clause), this.t1q_1.i1p(clause)]) : Utils_getInstance().n1o([this.s1q_1.i1p(clause), this.t1q_1.i1p(clause)]);
2298
+ };
2299
+ FamilyArityReteNode.prototype.y1q = function (clause) {
2300
+ var innerFirst = nestedFirstArgument_1(clause, this);
2301
+ return innerFirst.fx() ? Utils_getInstance().k1o([this.s1q_1.h1p(clause), this.q1q_1.h1p(clause)]) : innerFirst.aw() ? Utils_getInstance().k1o([this.s1q_1.h1p(clause), this.r1q_1.h1p(clause)]) : innerFirst.bx() ? Utils_getInstance().k1o([this.s1q_1.h1p(clause), this.q1q_1.h1p(clause), this.r1q_1.h1p(clause), this.t1q_1.h1p(clause)]) : Utils_getInstance().k1o([this.s1q_1.h1p(clause), this.t1q_1.h1p(clause)]);
2302
+ };
2303
+ FamilyArityReteNode.prototype.x1q = function (clause) {
2304
+ var innerFirst = nestedFirstArgument_1(clause, this);
2305
+ return innerFirst.fx() ? Utils_getInstance().n1o([this.s1q_1.h1p(clause), this.q1q_1.h1p(clause)]) : innerFirst.aw() ? Utils_getInstance().n1o([this.s1q_1.h1p(clause), this.r1q_1.h1p(clause)]) : innerFirst.bx() ? Utils_getInstance().n1o([this.s1q_1.h1p(clause), this.q1q_1.h1p(clause), this.r1q_1.h1p(clause), this.t1q_1.h1p(clause)]) : Utils_getInstance().n1o([this.s1q_1.h1p(clause), this.t1q_1.h1p(clause)]);
2306
+ };
2307
+ FamilyArityReteNode.prototype.v1q = function (clause) {
2308
+ var innerFirst = nestedFirstArgument_1(clause, this);
2309
+ var tmp;
2310
+ if (innerFirst.fx()) {
2311
+ var tmp0_elvis_lhs = this.s1q_1.g1p(clause);
2312
+ tmp = tmp0_elvis_lhs == null ? this.q1q_1.g1p(clause) : tmp0_elvis_lhs;
2313
+ } else if (innerFirst.aw()) {
2314
+ var tmp1_elvis_lhs = this.s1q_1.g1p(clause);
2315
+ tmp = tmp1_elvis_lhs == null ? this.r1q_1.g1p(clause) : tmp1_elvis_lhs;
2316
+ } else if (innerFirst.bx()) {
2317
+ var tmp2_elvis_lhs = this.s1q_1.g1p(clause);
2318
+ var tmp3_elvis_lhs = tmp2_elvis_lhs == null ? this.q1q_1.g1p(clause) : tmp2_elvis_lhs;
2319
+ var tmp4_elvis_lhs = tmp3_elvis_lhs == null ? this.r1q_1.g1p(clause) : tmp3_elvis_lhs;
2320
+ tmp = tmp4_elvis_lhs == null ? this.t1q_1.g1p(clause) : tmp4_elvis_lhs;
2321
+ } else {
2322
+ var tmp5_elvis_lhs = this.s1q_1.g1p(clause);
2323
+ tmp = tmp5_elvis_lhs == null ? this.t1q_1.g1p(clause) : tmp5_elvis_lhs;
2324
+ }
2325
+ return tmp;
2326
+ };
2327
+ FamilyArityReteNode.prototype.w1q = function (clause) {
2328
+ var innerFirst = nestedFirstArgument_1(clause, this);
2329
+ var tmp;
2330
+ if (innerFirst.fx()) {
2331
+ tmp = Utils_getInstance().s1o(this.q1q_1.g1p(clause), this.s1q_1.g1p(clause));
2332
+ } else if (innerFirst.aw()) {
2333
+ tmp = Utils_getInstance().s1o(this.r1q_1.g1p(clause), this.s1q_1.g1p(clause));
2334
+ } else if (innerFirst.bx()) {
2335
+ tmp = Utils_getInstance().s1o(Utils_getInstance().s1o(this.q1q_1.g1p(clause), this.r1q_1.g1p(clause)), Utils_getInstance().s1o(this.s1q_1.g1p(clause), this.t1q_1.g1p(clause)));
2336
+ } else {
2337
+ tmp = Utils_getInstance().s1o(this.s1q_1.g1p(clause), this.t1q_1.g1p(clause));
2338
+ }
2339
+ return tmp;
2340
+ };
2341
+ FamilyArityReteNode.prototype.t1n = function () {
2342
+ this.u1q_1.mq();
2343
+ };
2344
+ function isGlobal_1(_this__u8e3s4, $this) {
2345
+ return _this__u8e3s4.nw() ? Utils_getInstance().j1o(_this__u8e3s4.castToRule().ly(), $this.d1r_1).bx() : false;
2346
+ }
2347
+ function nestedArity(_this__u8e3s4, $this) {
2348
+ var tmp0_safe_receiver = _this__u8e3s4.asRule();
2349
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ly();
2350
+ var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : Utils_getInstance().h1o(tmp1_safe_receiver, $this.d1r_1);
2351
+ var tmp;
2352
+ if (tmp2_elvis_lhs == null) {
2353
+ throw IllegalStateException_init_$Create$('The nestedArity method cannot be invoked on non-rule clauses');
2354
+ } else {
2355
+ tmp = tmp2_elvis_lhs;
2356
+ }
2357
+ return tmp;
2358
+ }
2359
+ function nestedArity_0(_this__u8e3s4, $this) {
2360
+ return Utils_getInstance().h1o(ensureNotNull(_this__u8e3s4.p1n().ly()), $this.d1r_1);
2361
+ }
2362
+ function regenerateCache_1($this) {
2363
+ var tmp;
2364
+ if ($this.c1r_1) {
2365
+ var tmp_0 = Utils_getInstance();
2366
+ var tmp$ret$2;
2367
+ // Inline function 'kotlin.collections.map' call
2368
+ var tmp0_map = $this.e1r_1.c3();
2369
+ var tmp$ret$1;
2370
+ // Inline function 'kotlin.collections.mapTo' call
2371
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
2372
+ var tmp0_iterator = tmp0_map.j();
2373
+ while (tmp0_iterator.m()) {
2374
+ var item = tmp0_iterator.p();
2375
+ var tmp$ret$0;
2376
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.regenerateCache.<anonymous>' call
2377
+ tmp$ret$0 = item.k1p();
2378
+ tmp0_mapTo.g(tmp$ret$0);
2379
+ }
2380
+ tmp$ret$1 = tmp0_mapTo;
2381
+ tmp$ret$2 = tmp$ret$1;
2382
+ tmp = tmp_0.l1o(tmp$ret$2);
2383
+ } else {
2384
+ var tmp_1 = Utils_getInstance();
2385
+ var tmp$ret$5;
2386
+ // Inline function 'kotlin.collections.map' call
2387
+ var tmp1_map = $this.e1r_1.c3();
2388
+ var tmp$ret$4;
2389
+ // Inline function 'kotlin.collections.mapTo' call
2390
+ var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
2391
+ var tmp0_iterator_0 = tmp1_map.j();
2392
+ while (tmp0_iterator_0.m()) {
2393
+ var item_0 = tmp0_iterator_0.p();
2394
+ var tmp$ret$3;
2395
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.regenerateCache.<anonymous>' call
2396
+ tmp$ret$3 = item_0.k1p();
2397
+ tmp0_mapTo_0.g(tmp$ret$3);
2398
+ }
2399
+ tmp$ret$4 = tmp0_mapTo_0;
2400
+ tmp$ret$5 = tmp$ret$4;
2401
+ tmp = tmp_1.p1o(tmp$ret$5);
2402
+ }
2403
+ return dequeOf_0(tmp);
2404
+ }
2405
+ function FunctorIndexingNode$regenerateCache$ref($boundThis) {
2406
+ var l = function () {
2407
+ return regenerateCache_1($boundThis);
2408
+ };
2409
+ l.callableName = 'regenerateCache';
2410
+ return l;
2411
+ }
2412
+ function FunctorIndexingNode$_get_size_$lambda_vcufvm(it) {
2413
+ return it.o();
2414
+ }
2415
+ function FunctorIndexingNode$retractAllIndexed$lambda(this$0, $clause) {
2416
+ return function (it) {
2417
+ return this$0.k1l().match(it.p1n(), $clause);
2418
+ };
2419
+ }
2420
+ function FunctorIndexingNode(unificator, ordered, nestingLevel) {
2421
+ FunctorNode.call(this, unificator);
2422
+ this.c1r_1 = ordered;
2423
+ this.d1r_1 = nestingLevel;
2424
+ var tmp = this;
2425
+ var tmp$ret$0;
2426
+ // Inline function 'kotlin.collections.mutableMapOf' call
2427
+ tmp$ret$0 = LinkedHashMap_init_$Create$();
2428
+ tmp.e1r_1 = tmp$ret$0;
2429
+ var tmp_0 = this;
2430
+ var tmp_1 = Companion_getInstance_1();
2431
+ tmp_0.f1r_1 = tmp_1.kq(FunctorIndexingNode$regenerateCache$ref(this));
2432
+ }
2433
+ FunctorIndexingNode.prototype.o = function () {
2434
+ var tmp = asSequence(this.e1r_1.c3());
2435
+ return sum(map(tmp, FunctorIndexingNode$_get_size_$lambda_vcufvm));
2436
+ };
2437
+ FunctorIndexingNode.prototype.o1l = function () {
2438
+ var tmp;
2439
+ if (this.e1r_1.d()) {
2440
+ tmp = true;
2441
+ } else {
2442
+ var tmp$ret$0;
2443
+ $l$block_0: {
2444
+ // Inline function 'kotlin.collections.all' call
2445
+ var tmp0_all = this.e1r_1.c3();
2446
+ var tmp_0;
2447
+ if (isInterface(tmp0_all, Collection)) {
2448
+ tmp_0 = tmp0_all.d();
2449
+ } else {
2450
+ tmp_0 = false;
2451
+ }
2452
+ if (tmp_0) {
2453
+ tmp$ret$0 = true;
2454
+ break $l$block_0;
2455
+ }
2456
+ var tmp0_iterator = tmp0_all.j();
2457
+ while (tmp0_iterator.m()) {
2458
+ var element = tmp0_iterator.p();
2459
+ var tmp$ret$1;
2460
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.<get-isEmpty>.<anonymous>' call
2461
+ tmp$ret$1 = element.o1l();
2462
+ if (!tmp$ret$1) {
2463
+ tmp$ret$0 = false;
2464
+ break $l$block_0;
2465
+ }
2466
+ }
2467
+ tmp$ret$0 = true;
2468
+ }
2469
+ tmp = tmp$ret$0;
2470
+ }
2471
+ return tmp;
2472
+ };
2473
+ FunctorIndexingNode.prototype.r1n = function (clause) {
2474
+ var tmp$ret$1;
2475
+ // Inline function 'kotlin.collections.getOrPut' call
2476
+ var tmp0_getOrPut = this.e1r_1;
2477
+ var tmp1_getOrPut = nestedArity_0(clause, this);
2478
+ var value = tmp0_getOrPut.a3(tmp1_getOrPut);
2479
+ var tmp;
2480
+ if (value == null) {
2481
+ var tmp$ret$0;
2482
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.assertA.<anonymous>' call
2483
+ tmp$ret$0 = new FamilyArityIndexingNode(this.k1l(), this.c1r_1, this.d1r_1);
2484
+ var answer = tmp$ret$0;
2485
+ tmp0_getOrPut.w3(tmp1_getOrPut, answer);
2486
+ tmp = answer;
2487
+ } else {
2488
+ tmp = value;
2489
+ }
2490
+ tmp$ret$1 = tmp;
2491
+ tmp$ret$1.r1n(clause.w1o(this));
2492
+ };
2493
+ FunctorIndexingNode.prototype.s1n = function (clause) {
2494
+ var tmp$ret$1;
2495
+ // Inline function 'kotlin.collections.getOrPut' call
2496
+ var tmp0_getOrPut = this.e1r_1;
2497
+ var tmp1_getOrPut = nestedArity_0(clause, this);
2498
+ var value = tmp0_getOrPut.a3(tmp1_getOrPut);
2499
+ var tmp;
2500
+ if (value == null) {
2501
+ var tmp$ret$0;
2502
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.assertZ.<anonymous>' call
2503
+ tmp$ret$0 = new FamilyArityIndexingNode(this.k1l(), this.c1r_1, this.d1r_1);
2504
+ var answer = tmp$ret$0;
2505
+ tmp0_getOrPut.w3(tmp1_getOrPut, answer);
2506
+ tmp = answer;
2507
+ } else {
2508
+ tmp = value;
2509
+ }
2510
+ tmp$ret$1 = tmp;
2511
+ tmp$ret$1.s1n(clause.w1o(this));
2512
+ };
2513
+ FunctorIndexingNode.prototype.k1p = function () {
2514
+ return asSequence(this.f1r_1.b1());
2515
+ };
2516
+ FunctorIndexingNode.prototype.g1p = function (clause) {
2517
+ var tmp;
2518
+ if (isGlobal_1(clause, this)) {
2519
+ var tmp$ret$4;
2520
+ $l$block: {
2521
+ // Inline function 'kotlin.sequences.firstOrNull' call
2522
+ var tmp_0 = Utils_getInstance();
2523
+ var tmp$ret$2;
2524
+ // Inline function 'kotlin.collections.map' call
2525
+ var tmp0_map = this.e1r_1.c3();
2526
+ var tmp$ret$1;
2527
+ // Inline function 'kotlin.collections.mapTo' call
2528
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
2529
+ var tmp0_iterator = tmp0_map.j();
2530
+ while (tmp0_iterator.m()) {
2531
+ var item = tmp0_iterator.p();
2532
+ var tmp$ret$0;
2533
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.getFirstIndexed.<anonymous>' call
2534
+ tmp$ret$0 = item.j1p(clause);
2535
+ tmp0_mapTo.g(tmp$ret$0);
2536
+ }
2537
+ tmp$ret$1 = tmp0_mapTo;
2538
+ tmp$ret$2 = tmp$ret$1;
2539
+ var tmp1_firstOrNull = tmp_0.l1o(tmp$ret$2);
2540
+ var tmp0_iterator_0 = tmp1_firstOrNull.j();
2541
+ while (tmp0_iterator_0.m()) {
2542
+ var element = tmp0_iterator_0.p();
2543
+ var tmp$ret$3;
2544
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.getFirstIndexed.<anonymous>' call
2545
+ tmp$ret$3 = this.k1l().match(element.p1n(), clause);
2546
+ if (tmp$ret$3) {
2547
+ tmp$ret$4 = element;
2548
+ break $l$block;
2549
+ }
2550
+ }
2551
+ tmp$ret$4 = null;
2552
+ }
2553
+ tmp = tmp$ret$4;
2554
+ } else {
2555
+ var tmp0_safe_receiver = this.e1r_1.a3(nestedArity(clause, this));
2556
+ tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.g1p(clause);
2557
+ }
2558
+ return tmp;
2559
+ };
2560
+ FunctorIndexingNode.prototype.h1p = function (clause) {
2561
+ var tmp;
2562
+ if (isGlobal_1(clause, this)) {
2563
+ var tmp_0 = Utils_getInstance();
2564
+ var tmp$ret$2;
2565
+ // Inline function 'kotlin.collections.map' call
2566
+ var tmp0_map = this.e1r_1.c3();
2567
+ var tmp$ret$1;
2568
+ // Inline function 'kotlin.collections.mapTo' call
2569
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
2570
+ var tmp0_iterator = tmp0_map.j();
2571
+ while (tmp0_iterator.m()) {
2572
+ var item = tmp0_iterator.p();
2573
+ var tmp$ret$0;
2574
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.getIndexed.<anonymous>' call
2575
+ tmp$ret$0 = item.j1p(clause);
2576
+ tmp0_mapTo.g(tmp$ret$0);
2577
+ }
2578
+ tmp$ret$1 = tmp0_mapTo;
2579
+ tmp$ret$2 = tmp$ret$1;
2580
+ tmp = tmp_0.l1o(tmp$ret$2);
2581
+ } else {
2582
+ var tmp0_safe_receiver = this.e1r_1.a3(nestedArity(clause, this));
2583
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.h1p(clause);
2584
+ tmp = tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
2585
+ }
2586
+ return tmp;
2587
+ };
2588
+ FunctorIndexingNode.prototype.i1p = function (clause) {
2589
+ var tmp;
2590
+ if (isGlobal_1(clause, this)) {
2591
+ var tmp_0 = Utils_getInstance();
2592
+ var tmp$ret$2;
2593
+ // Inline function 'kotlin.collections.map' call
2594
+ var tmp0_map = this.e1r_1.c3();
2595
+ var tmp$ret$1;
2596
+ // Inline function 'kotlin.collections.mapTo' call
2597
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
2598
+ var tmp0_iterator = tmp0_map.j();
2599
+ while (tmp0_iterator.m()) {
2600
+ var item = tmp0_iterator.p();
2601
+ var tmp$ret$0;
2602
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.retractAllIndexed.<anonymous>' call
2603
+ tmp$ret$0 = item.j1p(clause);
2604
+ tmp0_mapTo.g(tmp$ret$0);
2605
+ }
2606
+ tmp$ret$1 = tmp0_mapTo;
2607
+ tmp$ret$2 = tmp$ret$1;
2608
+ var tmp_1 = tmp_0.l1o(tmp$ret$2);
2609
+ var partialResult = toList(filter(tmp_1, FunctorIndexingNode$retractAllIndexed$lambda(this, clause)));
2610
+ var tmp$ret$3;
2611
+ // Inline function 'kotlin.collections.isNotEmpty' call
2612
+ tmp$ret$3 = !partialResult.d();
2613
+ if (tmp$ret$3) {
2614
+ this.t1n();
2615
+ // Inline function 'kotlin.collections.forEach' call
2616
+ var tmp0_iterator_0 = partialResult.j();
2617
+ while (tmp0_iterator_0.m()) {
2618
+ var element = tmp0_iterator_0.p();
2619
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.retractAllIndexed.<anonymous>' call
2620
+ element.c1p();
2621
+ }
2622
+ }
2623
+ tmp = asSequence(partialResult);
2624
+ } else {
2625
+ var tmp0_safe_receiver = this.e1r_1.a3(nestedArity(clause, this));
2626
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.i1p(clause);
2627
+ tmp = tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
2628
+ }
2629
+ return tmp;
2630
+ };
2631
+ FunctorIndexingNode.prototype.j1p = function (clause) {
2632
+ var tmp;
2633
+ if (this.c1r_1) {
2634
+ var tmp_0 = Utils_getInstance();
2635
+ var tmp$ret$2;
2636
+ // Inline function 'kotlin.collections.map' call
2637
+ var tmp0_map = this.e1r_1.c3();
2638
+ var tmp$ret$1;
2639
+ // Inline function 'kotlin.collections.mapTo' call
2640
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
2641
+ var tmp0_iterator = tmp0_map.j();
2642
+ while (tmp0_iterator.m()) {
2643
+ var item = tmp0_iterator.p();
2644
+ var tmp$ret$0;
2645
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.extractGlobalIndexedSequence.<anonymous>' call
2646
+ tmp$ret$0 = item.j1p(clause);
2647
+ tmp0_mapTo.g(tmp$ret$0);
2648
+ }
2649
+ tmp$ret$1 = tmp0_mapTo;
2650
+ tmp$ret$2 = tmp$ret$1;
2651
+ tmp = tmp_0.l1o(tmp$ret$2);
2652
+ } else {
2653
+ var tmp_1 = Utils_getInstance();
2654
+ var tmp$ret$5;
2655
+ // Inline function 'kotlin.collections.map' call
2656
+ var tmp1_map = this.e1r_1.c3();
2657
+ var tmp$ret$4;
2658
+ // Inline function 'kotlin.collections.mapTo' call
2659
+ var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
2660
+ var tmp0_iterator_0 = tmp1_map.j();
2661
+ while (tmp0_iterator_0.m()) {
2662
+ var item_0 = tmp0_iterator_0.p();
2663
+ var tmp$ret$3;
2664
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.FunctorIndexingNode.extractGlobalIndexedSequence.<anonymous>' call
2665
+ tmp$ret$3 = item_0.j1p(clause);
2666
+ tmp0_mapTo_0.g(tmp$ret$3);
2667
+ }
2668
+ tmp$ret$4 = tmp0_mapTo_0;
2669
+ tmp$ret$5 = tmp$ret$4;
2670
+ tmp = tmp_1.p1o(tmp$ret$5);
2671
+ }
2672
+ return tmp;
2673
+ };
2674
+ FunctorIndexingNode.prototype.t1n = function () {
2675
+ this.f1r_1.mq();
2676
+ };
2677
+ function FunctorNode(unificator) {
2678
+ AbstractReteNode.call(this, unificator);
2679
+ }
2680
+ function assignHigherIndex($this, clause) {
2681
+ var tmp = Companion_getInstance_10();
2682
+ var tmp0_this = $this;
2683
+ tmp0_this.m1r_1 = tmp0_this.m1r_1.gh();
2684
+ return tmp.y1o(tmp0_this.m1r_1, clause, [$this]);
2685
+ }
2686
+ function assignLowerIndex($this, clause) {
2687
+ var tmp = Companion_getInstance_10();
2688
+ var tmp0_this = $this;
2689
+ tmp0_this.l1r_1 = tmp0_this.l1r_1.hh();
2690
+ return tmp.y1o(tmp0_this.l1r_1, clause, [$this]);
2691
+ }
2692
+ function regenerateCache_2($this) {
2693
+ var tmp;
2694
+ if ($this.h1r_1) {
2695
+ var tmp_0 = Utils_getInstance().k1o([$this.k1r_1.k1p(), $this.j1r_1.k1p()]);
2696
+ tmp = map(tmp_0, RootNode$regenerateCache$lambda);
2697
+ } else {
2698
+ var tmp_1 = Utils_getInstance();
2699
+ var tmp_2 = $this.k1r_1.k1p();
2700
+ var tmp_3 = map(tmp_2, RootNode$regenerateCache$lambda_0);
2701
+ var tmp_4 = $this.j1r_1.k1p();
2702
+ tmp = tmp_1.q1o([tmp_3, map(tmp_4, RootNode$regenerateCache$lambda_1)]);
2703
+ }
2704
+ return dequeOf_0(tmp);
2705
+ }
2706
+ function RootNode$regenerateCache$ref($boundThis) {
2707
+ var l = function () {
2708
+ return regenerateCache_2($boundThis);
2709
+ };
2710
+ l.callableName = 'regenerateCache';
2711
+ return l;
2712
+ }
2713
+ function RootNode$_get_directives_$lambda_9lfp1g(it) {
2714
+ return it.b1().castToDirective();
2715
+ }
2716
+ function RootNode$_get_rules_$lambda_py6utr(it) {
2717
+ return it.b1().castToRule();
2718
+ }
2719
+ function RootNode$assertA$lambda($clause) {
2720
+ return function (it) {
2721
+ addFirst(it, $clause);
2722
+ return Unit_getInstance();
2723
+ };
2724
+ }
2725
+ function RootNode$assertZ$lambda($clause) {
2726
+ return function (it) {
2727
+ return it.g($clause);
2728
+ };
2729
+ }
2730
+ function RootNode$regenerateCache$lambda(it) {
2731
+ return it.p1n();
2732
+ }
2733
+ function RootNode$regenerateCache$lambda_0(it) {
2734
+ return it.p1n();
2735
+ }
2736
+ function RootNode$regenerateCache$lambda_1(it) {
2737
+ return it.p1n();
2738
+ }
2739
+ function RootNode(unificator, clauses, isOrdered) {
2740
+ this.g1r_1 = unificator;
2741
+ this.h1r_1 = isOrdered;
2742
+ var tmp = this;
2743
+ var tmp_0 = Companion_getInstance_1();
2744
+ tmp.i1r_1 = tmp_0.kq(RootNode$regenerateCache$ref(this));
2745
+ this.j1r_1 = new RuleNode(this.g1r_1, this.h1r_1);
2746
+ this.k1r_1 = new DirectiveIndex(this.g1r_1, this.h1r_1);
2747
+ this.l1r_1 = new Long(0, 0);
2748
+ this.m1r_1 = new Long(0, 0);
2749
+ // Inline function 'kotlin.collections.forEach' call
2750
+ var tmp0_iterator = clauses.j();
2751
+ while (tmp0_iterator.m()) {
2752
+ var element = tmp0_iterator.p();
2753
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.RootNode.<anonymous>' call
2754
+ this.w1l(element);
2755
+ }
2756
+ }
2757
+ RootNode.prototype.k1l = function () {
2758
+ return this.g1r_1;
2759
+ };
2760
+ RootNode.prototype.s1m = function () {
2761
+ return this.h1r_1;
2762
+ };
2763
+ RootNode.prototype.o = function () {
2764
+ return this.k1r_1.o() + this.j1r_1.o() | 0;
2765
+ };
2766
+ RootNode.prototype.o1l = function () {
2767
+ return this.k1r_1.o1l() ? this.j1r_1.o1l() : false;
2768
+ };
2769
+ RootNode.prototype.t1l = function () {
2770
+ return asSequence(this.i1r_1.b1());
2771
+ };
2772
+ RootNode.prototype.m1l = function () {
2773
+ var tmp = this.k1r_1.k1p();
2774
+ return map(tmp, RootNode$_get_directives_$lambda_9lfp1g);
2775
+ };
2776
+ RootNode.prototype.n1l = function () {
2777
+ var tmp = this.j1r_1.k1p();
2778
+ return map(tmp, RootNode$_get_rules_$lambda_py6utr);
2779
+ };
2780
+ RootNode.prototype.r1l = function (clause) {
2781
+ return clause.ow() ? this.k1r_1.r1l(clause) : this.j1r_1.r1l(clause);
2782
+ };
2783
+ RootNode.prototype.a1m = function (clause) {
2784
+ var tmp;
2785
+ if (clause.ow()) {
2786
+ tmp = this.k1r_1.a1m(clause);
2787
+ } else {
2788
+ tmp = this.j1r_1.a1m(clause);
2789
+ }
2790
+ return tmp;
2791
+ };
2792
+ RootNode.prototype.c1m = function (clause) {
2793
+ var tmp;
2794
+ if (clause.ow()) {
2795
+ tmp = this.k1r_1.c1m(clause);
2796
+ } else {
2797
+ tmp = this.j1r_1.c1m(clause);
2798
+ }
2799
+ return tmp;
2800
+ };
2801
+ RootNode.prototype.f1m = function () {
2802
+ return new RootNode(this.g1r_1, asIterable(this.t1l()), this.h1r_1);
2803
+ };
2804
+ RootNode.prototype.w1m = function (clause) {
2805
+ var indexed = assignLowerIndex(this, clause);
2806
+ if (this.h1r_1) {
2807
+ this.i1r_1.nq(RootNode$assertA$lambda(clause));
2808
+ if (clause.ow()) {
2809
+ this.k1r_1.r1n(indexed);
2810
+ } else {
2811
+ this.j1r_1.r1n(indexed);
2812
+ }
2813
+ } else {
2814
+ throw UnsupportedOperationException_init_$Create$('An unordered ReteTree cannot perform the assertA operation.');
2815
+ }
2816
+ };
2817
+ RootNode.prototype.w1l = function (clause) {
2818
+ var indexed = assignHigherIndex(this, clause);
2819
+ this.i1r_1.nq(RootNode$assertZ$lambda(clause));
2820
+ if (clause.ow()) {
2821
+ this.k1r_1.s1n(indexed);
2822
+ } else {
2823
+ this.j1r_1.s1n(indexed);
2824
+ }
2825
+ };
2826
+ RootNode.prototype.t1n = function () {
2827
+ this.i1r_1.mq();
2828
+ };
2829
+ function nestedFunctor_1(_this__u8e3s4, $this) {
2830
+ return Utils_getInstance().i1o(ensureNotNull(_this__u8e3s4.ly()), 0);
2831
+ }
2832
+ function nestedFunctor_2(_this__u8e3s4, $this) {
2833
+ return nestedFunctor_1(_this__u8e3s4.p1n(), $this);
2834
+ }
2835
+ function regenerateCache_3($this) {
2836
+ var tmp;
2837
+ if ($this.o1r_1) {
2838
+ var tmp_0 = Utils_getInstance();
2839
+ var tmp$ret$2;
2840
+ // Inline function 'kotlin.collections.map' call
2841
+ var tmp0_map = $this.p1r_1.c3();
2842
+ var tmp$ret$1;
2843
+ // Inline function 'kotlin.collections.mapTo' call
2844
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
2845
+ var tmp0_iterator = tmp0_map.j();
2846
+ while (tmp0_iterator.m()) {
2847
+ var item = tmp0_iterator.p();
2848
+ var tmp$ret$0;
2849
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.RuleNode.regenerateCache.<anonymous>' call
2850
+ tmp$ret$0 = item.k1p();
2851
+ tmp0_mapTo.g(tmp$ret$0);
2852
+ }
2853
+ tmp$ret$1 = tmp0_mapTo;
2854
+ tmp$ret$2 = tmp$ret$1;
2855
+ tmp = tmp_0.l1o(tmp$ret$2);
2856
+ } else {
2857
+ var tmp_1 = Utils_getInstance();
2858
+ var tmp$ret$5;
2859
+ // Inline function 'kotlin.collections.map' call
2860
+ var tmp1_map = $this.p1r_1.c3();
2861
+ var tmp$ret$4;
2862
+ // Inline function 'kotlin.collections.mapTo' call
2863
+ var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
2864
+ var tmp0_iterator_0 = tmp1_map.j();
2865
+ while (tmp0_iterator_0.m()) {
2866
+ var item_0 = tmp0_iterator_0.p();
2867
+ var tmp$ret$3;
2868
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.RuleNode.regenerateCache.<anonymous>' call
2869
+ tmp$ret$3 = item_0.k1p();
2870
+ tmp0_mapTo_0.g(tmp$ret$3);
2871
+ }
2872
+ tmp$ret$4 = tmp0_mapTo_0;
2873
+ tmp$ret$5 = tmp$ret$4;
2874
+ tmp = tmp_1.p1o(tmp$ret$5);
2875
+ }
2876
+ return dequeOf_0(tmp);
2877
+ }
2878
+ function RuleNode$regenerateCache$ref($boundThis) {
2879
+ var l = function () {
2880
+ return regenerateCache_3($boundThis);
2881
+ };
2882
+ l.callableName = 'regenerateCache';
2883
+ return l;
2884
+ }
2885
+ function RuleNode$_get_size_$lambda_xjenvf(it) {
2886
+ return it.o();
2887
+ }
2888
+ function RuleNode(unificator, ordered) {
2889
+ this.n1r_1 = unificator;
2890
+ this.o1r_1 = ordered;
2891
+ var tmp = this;
2892
+ var tmp$ret$0;
2893
+ // Inline function 'kotlin.collections.mutableMapOf' call
2894
+ tmp$ret$0 = LinkedHashMap_init_$Create$();
2895
+ tmp.p1r_1 = tmp$ret$0;
2896
+ var tmp_0 = this;
2897
+ var tmp_1 = Companion_getInstance_1();
2898
+ tmp_0.q1r_1 = tmp_1.kq(RuleNode$regenerateCache$ref(this));
2899
+ }
2900
+ RuleNode.prototype.r1l = function (clause) {
2901
+ var tmp0_safe_receiver = this.p1r_1.a3(nestedFunctor_1(clause, this));
2902
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r1l(clause);
2903
+ return tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
2904
+ };
2905
+ RuleNode.prototype.r1n = function (clause) {
2906
+ var tmp$ret$2;
2907
+ // Inline function 'kotlin.let' call
2908
+ var tmp0_let = nestedFunctor_2(clause, this);
2909
+ // Inline function 'kotlin.contracts.contract' call
2910
+ var tmp;
2911
+ if (this.o1r_1) {
2912
+ var tmp$ret$1;
2913
+ // Inline function 'kotlin.collections.getOrPut' call
2914
+ var tmp0_getOrPut = this.p1r_1;
2915
+ var value = tmp0_getOrPut.a3(tmp0_let);
2916
+ var tmp_0;
2917
+ if (value == null) {
2918
+ var tmp$ret$0;
2919
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.RuleNode.assertA.<anonymous>.<anonymous>' call
2920
+ tmp$ret$0 = new TopLevelFunctorReteNode(this.n1r_1, this.o1r_1, 0);
2921
+ var answer = tmp$ret$0;
2922
+ tmp0_getOrPut.w3(tmp0_let, answer);
2923
+ tmp_0 = answer;
2924
+ } else {
2925
+ tmp_0 = value;
2926
+ }
2927
+ tmp$ret$1 = tmp_0;
2928
+ tmp$ret$1.r1n(clause.w1o(this));
2929
+ tmp = Unit_getInstance();
2930
+ } else {
2931
+ this.s1n(clause);
2932
+ tmp = Unit_getInstance();
2933
+ }
2934
+ tmp$ret$2 = tmp;
2935
+ };
2936
+ RuleNode.prototype.s1n = function (clause) {
2937
+ var tmp$ret$2;
2938
+ // Inline function 'kotlin.let' call
2939
+ var tmp0_let = nestedFunctor_2(clause, this);
2940
+ // Inline function 'kotlin.contracts.contract' call
2941
+ var tmp$ret$1;
2942
+ // Inline function 'kotlin.collections.getOrPut' call
2943
+ var tmp0_getOrPut = this.p1r_1;
2944
+ var value = tmp0_getOrPut.a3(tmp0_let);
2945
+ var tmp;
2946
+ if (value == null) {
2947
+ var tmp$ret$0;
2948
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.RuleNode.assertZ.<anonymous>.<anonymous>' call
2949
+ tmp$ret$0 = new TopLevelFunctorReteNode(this.n1r_1, this.o1r_1, 0);
2950
+ var answer = tmp$ret$0;
2951
+ tmp0_getOrPut.w3(tmp0_let, answer);
2952
+ tmp = answer;
2953
+ } else {
2954
+ tmp = value;
2955
+ }
2956
+ tmp$ret$1 = tmp;
2957
+ tmp$ret$1.s1n(clause.w1o(this));
2958
+ tmp$ret$2 = Unit_getInstance();
2959
+ };
2960
+ RuleNode.prototype.a1m = function (clause) {
2961
+ var tmp0_safe_receiver = this.p1r_1.a3(nestedFunctor_1(clause, this));
2962
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.a1m(clause);
2963
+ return tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
2964
+ };
2965
+ RuleNode.prototype.o = function () {
2966
+ var tmp = asSequence(this.p1r_1.c3());
2967
+ return sum(map(tmp, RuleNode$_get_size_$lambda_xjenvf));
2968
+ };
2969
+ RuleNode.prototype.o1l = function () {
2970
+ var tmp;
2971
+ if (this.p1r_1.d()) {
2972
+ tmp = true;
2973
+ } else {
2974
+ var tmp$ret$0;
2975
+ $l$block_0: {
2976
+ // Inline function 'kotlin.collections.all' call
2977
+ var tmp0_all = this.p1r_1.c3();
2978
+ var tmp_0;
2979
+ if (isInterface(tmp0_all, Collection)) {
2980
+ tmp_0 = tmp0_all.d();
2981
+ } else {
2982
+ tmp_0 = false;
2983
+ }
2984
+ if (tmp_0) {
2985
+ tmp$ret$0 = true;
2986
+ break $l$block_0;
2987
+ }
2988
+ var tmp0_iterator = tmp0_all.j();
2989
+ while (tmp0_iterator.m()) {
2990
+ var element = tmp0_iterator.p();
2991
+ var tmp$ret$1;
2992
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.RuleNode.<get-isEmpty>.<anonymous>' call
2993
+ tmp$ret$1 = element.o1l();
2994
+ if (!tmp$ret$1) {
2995
+ tmp$ret$0 = false;
2996
+ break $l$block_0;
2997
+ }
2998
+ }
2999
+ tmp$ret$0 = true;
3000
+ }
3001
+ tmp = tmp$ret$0;
3002
+ }
3003
+ return tmp;
3004
+ };
3005
+ RuleNode.prototype.c1m = function (clause) {
3006
+ var tmp0_safe_receiver = this.p1r_1.a3(nestedFunctor_1(clause, this));
3007
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.c1m(clause);
3008
+ return tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
3009
+ };
3010
+ RuleNode.prototype.k1p = function () {
3011
+ return asSequence(this.q1r_1.b1());
3012
+ };
3013
+ RuleNode.prototype.t1n = function () {
3014
+ this.q1r_1.mq();
3015
+ };
3016
+ function selectArity($this, clause) {
3017
+ return $this.u1r_1.a3(Utils_getInstance().h1o(ensureNotNull(clause.ly()), $this.t1r_1));
3018
+ }
3019
+ function chooseAssertionBranch($this, clause, op) {
3020
+ var tmp$ret$5;
3021
+ // Inline function 'kotlin.let' call
3022
+ var tmp0_let = Utils_getInstance().h1o(ensureNotNull(clause.p1n().ly()), $this.t1r_1);
3023
+ // Inline function 'kotlin.contracts.contract' call
3024
+ var tmp$ret$4;
3025
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.TopLevelFunctorReteNode.chooseAssertionBranch.<anonymous>' call
3026
+ var tmp0_subject = tmp0_let;
3027
+ var tmp;
3028
+ if (tmp0_subject === 0) {
3029
+ var tmp$ret$1;
3030
+ // Inline function 'kotlin.collections.getOrPut' call
3031
+ var tmp0_getOrPut = $this.u1r_1;
3032
+ var value = tmp0_getOrPut.a3(tmp0_let);
3033
+ var tmp_0;
3034
+ if (value == null) {
3035
+ var tmp$ret$0;
3036
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.TopLevelFunctorReteNode.chooseAssertionBranch.<anonymous>.<anonymous>' call
3037
+ tmp$ret$0 = new ZeroArityReteNode($this.k1l(), $this.s1r_1);
3038
+ var answer = tmp$ret$0;
3039
+ tmp0_getOrPut.w3(tmp0_let, answer);
3040
+ tmp_0 = answer;
3041
+ } else {
3042
+ tmp_0 = value;
3043
+ }
3044
+ tmp$ret$1 = tmp_0;
3045
+ tmp = tmp$ret$1;
3046
+ } else {
3047
+ var tmp$ret$3;
3048
+ // Inline function 'kotlin.collections.getOrPut' call
3049
+ var tmp1_getOrPut = $this.u1r_1;
3050
+ var value_0 = tmp1_getOrPut.a3(tmp0_let);
3051
+ var tmp_1;
3052
+ if (value_0 == null) {
3053
+ var tmp$ret$2;
3054
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.TopLevelFunctorReteNode.chooseAssertionBranch.<anonymous>.<anonymous>' call
3055
+ tmp$ret$2 = new FamilyArityReteNode($this.k1l(), $this.s1r_1, $this.t1r_1);
3056
+ var answer_0 = tmp$ret$2;
3057
+ tmp1_getOrPut.w3(tmp0_let, answer_0);
3058
+ tmp_1 = answer_0;
3059
+ } else {
3060
+ tmp_1 = value_0;
3061
+ }
3062
+ tmp$ret$3 = tmp_1;
3063
+ tmp = tmp$ret$3;
3064
+ }
3065
+ tmp$ret$4 = tmp;
3066
+ tmp$ret$5 = tmp$ret$4;
3067
+ op(tmp$ret$5, clause);
3068
+ }
3069
+ function regenerateCache_4($this) {
3070
+ var tmp;
3071
+ if ($this.s1r_1) {
3072
+ var tmp_0 = Utils_getInstance();
3073
+ var tmp$ret$2;
3074
+ // Inline function 'kotlin.collections.map' call
3075
+ var tmp0_map = $this.u1r_1.c3();
3076
+ var tmp$ret$1;
3077
+ // Inline function 'kotlin.collections.mapTo' call
3078
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp0_map, 10));
3079
+ var tmp0_iterator = tmp0_map.j();
3080
+ while (tmp0_iterator.m()) {
3081
+ var item = tmp0_iterator.p();
3082
+ var tmp$ret$0;
3083
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.TopLevelFunctorReteNode.regenerateCache.<anonymous>' call
3084
+ tmp$ret$0 = item.k1p();
3085
+ tmp0_mapTo.g(tmp$ret$0);
3086
+ }
3087
+ tmp$ret$1 = tmp0_mapTo;
3088
+ tmp$ret$2 = tmp$ret$1;
3089
+ tmp = tmp_0.l1o(tmp$ret$2);
3090
+ } else {
3091
+ var tmp_1 = Utils_getInstance();
3092
+ var tmp$ret$5;
3093
+ // Inline function 'kotlin.collections.map' call
3094
+ var tmp1_map = $this.u1r_1.c3();
3095
+ var tmp$ret$4;
3096
+ // Inline function 'kotlin.collections.mapTo' call
3097
+ var tmp0_mapTo_0 = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
3098
+ var tmp0_iterator_0 = tmp1_map.j();
3099
+ while (tmp0_iterator_0.m()) {
3100
+ var item_0 = tmp0_iterator_0.p();
3101
+ var tmp$ret$3;
3102
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.TopLevelFunctorReteNode.regenerateCache.<anonymous>' call
3103
+ tmp$ret$3 = item_0.k1p();
3104
+ tmp0_mapTo_0.g(tmp$ret$3);
3105
+ }
3106
+ tmp$ret$4 = tmp0_mapTo_0;
3107
+ tmp$ret$5 = tmp$ret$4;
3108
+ tmp = tmp_1.p1o(tmp$ret$5);
3109
+ }
3110
+ return dequeOf_0(tmp);
3111
+ }
3112
+ function TopLevelFunctorReteNode$regenerateCache$ref($boundThis) {
3113
+ var l = function () {
3114
+ return regenerateCache_4($boundThis);
3115
+ };
3116
+ l.callableName = 'regenerateCache';
3117
+ return l;
3118
+ }
3119
+ function TopLevelFunctorReteNode$_get_size_$lambda_6i36rr(it) {
3120
+ return it.o();
3121
+ }
3122
+ function ReteNode$assertA$ref() {
3123
+ var l = function (p0, p1) {
3124
+ p0.r1n(p1);
3125
+ return Unit_getInstance();
3126
+ };
3127
+ l.callableName = 'assertA';
3128
+ return l;
3129
+ }
3130
+ function ReteNode$assertZ$ref() {
3131
+ var l = function (p0, p1) {
3132
+ p0.s1n(p1);
3133
+ return Unit_getInstance();
3134
+ };
3135
+ l.callableName = 'assertZ';
3136
+ return l;
3137
+ }
3138
+ function TopLevelFunctorReteNode(unificator, ordered, nestingLevel) {
3139
+ FunctorNode.call(this, unificator);
3140
+ this.s1r_1 = ordered;
3141
+ this.t1r_1 = nestingLevel;
3142
+ var tmp = this;
3143
+ var tmp$ret$0;
3144
+ // Inline function 'kotlin.collections.mutableMapOf' call
3145
+ tmp$ret$0 = LinkedHashMap_init_$Create$();
3146
+ tmp.u1r_1 = tmp$ret$0;
3147
+ var tmp_0 = this;
3148
+ var tmp_1 = Companion_getInstance_1();
3149
+ tmp_0.v1r_1 = tmp_1.kq(TopLevelFunctorReteNode$regenerateCache$ref(this));
3150
+ }
3151
+ TopLevelFunctorReteNode.prototype.o = function () {
3152
+ var tmp = asSequence(this.u1r_1.c3());
3153
+ return sum(map(tmp, TopLevelFunctorReteNode$_get_size_$lambda_6i36rr));
3154
+ };
3155
+ TopLevelFunctorReteNode.prototype.o1l = function () {
3156
+ var tmp;
3157
+ if (this.u1r_1.d()) {
3158
+ tmp = true;
3159
+ } else {
3160
+ var tmp$ret$0;
3161
+ $l$block_0: {
3162
+ // Inline function 'kotlin.collections.all' call
3163
+ var tmp0_all = this.u1r_1.c3();
3164
+ var tmp_0;
3165
+ if (isInterface(tmp0_all, Collection)) {
3166
+ tmp_0 = tmp0_all.d();
3167
+ } else {
3168
+ tmp_0 = false;
3169
+ }
3170
+ if (tmp_0) {
3171
+ tmp$ret$0 = true;
3172
+ break $l$block_0;
3173
+ }
3174
+ var tmp0_iterator = tmp0_all.j();
3175
+ while (tmp0_iterator.m()) {
3176
+ var element = tmp0_iterator.p();
3177
+ var tmp$ret$1;
3178
+ // Inline function 'it.unibo.tuprolog.collections.rete.custom.nodes.TopLevelFunctorReteNode.<get-isEmpty>.<anonymous>' call
3179
+ tmp$ret$1 = element.o1l();
3180
+ if (!tmp$ret$1) {
3181
+ tmp$ret$0 = false;
3182
+ break $l$block_0;
3183
+ }
3184
+ }
3185
+ tmp$ret$0 = true;
3186
+ }
3187
+ tmp = tmp$ret$0;
3188
+ }
3189
+ return tmp;
3190
+ };
3191
+ TopLevelFunctorReteNode.prototype.r1l = function (clause) {
3192
+ var tmp0_safe_receiver = selectArity(this, clause);
3193
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r1l(clause);
3194
+ return tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
3195
+ };
3196
+ TopLevelFunctorReteNode.prototype.r1n = function (clause) {
3197
+ var tmp = clause.w1o(this);
3198
+ chooseAssertionBranch(this, tmp, ReteNode$assertA$ref());
3199
+ };
3200
+ TopLevelFunctorReteNode.prototype.s1n = function (clause) {
3201
+ var tmp = clause.w1o(this);
3202
+ chooseAssertionBranch(this, tmp, ReteNode$assertZ$ref());
3203
+ };
3204
+ TopLevelFunctorReteNode.prototype.a1m = function (clause) {
3205
+ var tmp0_safe_receiver = selectArity(this, clause);
3206
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.a1m(clause);
3207
+ return tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
3208
+ };
3209
+ TopLevelFunctorReteNode.prototype.c1m = function (clause) {
3210
+ var tmp0_safe_receiver = selectArity(this, clause);
3211
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.c1m(clause);
3212
+ return tmp1_elvis_lhs == null ? emptySequence() : tmp1_elvis_lhs;
3213
+ };
3214
+ TopLevelFunctorReteNode.prototype.k1p = function () {
3215
+ return asSequence(this.v1r_1.b1());
3216
+ };
3217
+ TopLevelFunctorReteNode.prototype.t1n = function () {
3218
+ this.v1r_1.mq();
3219
+ };
3220
+ function ZeroArityReteNode$retractFirst$lambda(it) {
3221
+ return it.p1n();
3222
+ }
3223
+ function ZeroArityReteNode$get$lambda(this$0, $clause) {
3224
+ return function (it) {
3225
+ return this$0.k1l().match(it.p1n(), $clause);
3226
+ };
3227
+ }
3228
+ function ZeroArityReteNode$get$lambda_0(it) {
3229
+ return it.p1n();
3230
+ }
3231
+ function ZeroArityReteNode$retractAll$lambda(it) {
3232
+ return it.p1n();
3233
+ }
3234
+ function ZeroArityReteNode(unificator, ordered) {
3235
+ ArityNode.call(this, unificator);
3236
+ this.x1r_1 = ordered;
3237
+ this.y1r_1 = dequeOf([]);
3238
+ }
3239
+ ZeroArityReteNode.prototype.a1m = function (clause) {
3240
+ var tmp = this.q1n(this.y1r_1, clause);
3241
+ return buffered(take(map(tmp, ZeroArityReteNode$retractFirst$lambda), 1));
3242
+ };
3243
+ ZeroArityReteNode.prototype.o = function () {
3244
+ return this.y1r_1.o();
3245
+ };
3246
+ ZeroArityReteNode.prototype.o1l = function () {
3247
+ return this.y1r_1.d();
3248
+ };
3249
+ ZeroArityReteNode.prototype.r1l = function (clause) {
3250
+ var tmp = asSequence(this.y1r_1);
3251
+ var tmp_0 = filter(tmp, ZeroArityReteNode$get$lambda(this, clause));
3252
+ return map(tmp_0, ZeroArityReteNode$get$lambda_0);
3253
+ };
3254
+ ZeroArityReteNode.prototype.r1n = function (clause) {
3255
+ if (this.x1r_1) {
3256
+ addFirst(this.y1r_1, Companion_getInstance_11().e1p(clause.w1o(this), this));
3257
+ } else {
3258
+ this.s1n(clause);
3259
+ }
3260
+ };
3261
+ ZeroArityReteNode.prototype.s1n = function (clause) {
3262
+ this.y1r_1.g(Companion_getInstance_11().e1p(clause.w1o(this), this));
3263
+ };
3264
+ ZeroArityReteNode.prototype.c1m = function (clause) {
3265
+ var tmp = this.q1n(this.y1r_1, clause);
3266
+ return buffered(map(tmp, ZeroArityReteNode$retractAll$lambda));
3267
+ };
3268
+ ZeroArityReteNode.prototype.k1p = function () {
3269
+ return asSequence(this.y1r_1);
3270
+ };
3271
+ ZeroArityReteNode.prototype.t1n = function () {
3272
+ };
3273
+ ZeroArityReteNode.prototype.d1p = function (indexed) {
3274
+ this.y1r_1.ia(indexed);
3275
+ };
3276
+ function AbstractTheory$get$lambda(it) {
3277
+ return it.castToRule();
3278
+ }
3279
+ function AbstractTheory$get$lambda_0(it) {
3280
+ return it.castToRule();
3281
+ }
3282
+ function AbstractTheory(tags) {
3283
+ this.z1r_1 = tags;
3284
+ }
3285
+ AbstractTheory.prototype.kt = function () {
3286
+ return this.z1r_1;
3287
+ };
3288
+ AbstractTheory.prototype.a1s = function () {
3289
+ return this;
3290
+ };
3291
+ AbstractTheory.prototype.toImmutableTheory = function () {
3292
+ return this.a1s();
3293
+ };
3294
+ AbstractTheory.prototype.b1s = function (clause) {
3295
+ return plus_2.call(this, TheoryUtils_getInstance().g1m(clause));
3296
+ };
3297
+ AbstractTheory.prototype.plus = function (clause) {
3298
+ return this.b1s(clause);
3299
+ };
3300
+ AbstractTheory.prototype.q1l = function (clause) {
3301
+ return any(this.get(clause));
3302
+ };
3303
+ AbstractTheory.prototype.contains = function (clause) {
3304
+ return this.q1l(clause);
3305
+ };
3306
+ AbstractTheory.prototype.c1s = function (head) {
3307
+ return this.q1l(Companion_getInstance_2().of(head, [Companion_getInstance_3().anonymous()]));
3308
+ };
3309
+ AbstractTheory.prototype.containsHead = function (head) {
3310
+ return this.c1s(head);
3311
+ };
3312
+ AbstractTheory.prototype.d1s = function (indicator) {
3313
+ return any(this.e1s(indicator));
3314
+ };
3315
+ AbstractTheory.prototype.containsIndicator = function (indicator) {
3316
+ return this.d1s(indicator);
3317
+ };
3318
+ AbstractTheory.prototype.f1s = function (head) {
3319
+ var tmp = this.get(Companion_getInstance_2().of(head, [Companion_getInstance_3().anonymous()]));
3320
+ return map(tmp, AbstractTheory$get$lambda);
3321
+ };
3322
+ AbstractTheory.prototype.getByHead = function (head) {
3323
+ return this.f1s(head);
3324
+ };
3325
+ AbstractTheory.prototype.e1s = function (indicator) {
3326
+ // Inline function 'kotlin.require' call
3327
+ var tmp0_require = indicator.vy();
3328
+ // Inline function 'kotlin.contracts.contract' call
3329
+ if (!tmp0_require) {
3330
+ var tmp$ret$0;
3331
+ // Inline function 'it.unibo.tuprolog.theory.AbstractTheory.get.<anonymous>' call
3332
+ tmp$ret$0 = 'The provided indicator is not well formed: ' + indicator;
3333
+ var message = tmp$ret$0;
3334
+ throw IllegalArgumentException_init_$Create$(toString(message));
3335
+ }
3336
+ var tmp = Companion_getInstance_2();
3337
+ var tmp_0 = Companion_getInstance_4();
3338
+ var tmp_1 = ensureNotNull(indicator.q10());
3339
+ var tmp$ret$3;
3340
+ // Inline function 'kotlin.collections.map' call
3341
+ var tmp1_map = numberRangeToNumber(1, ensureNotNull(indicator.r10()));
3342
+ var tmp$ret$2;
3343
+ // Inline function 'kotlin.collections.mapTo' call
3344
+ var tmp0_mapTo = ArrayList_init_$Create$(collectionSizeOrDefault(tmp1_map, 10));
3345
+ var inductionVariable = tmp1_map.o8_1;
3346
+ var last = tmp1_map.p8_1;
3347
+ if (inductionVariable <= last)
3348
+ do {
3349
+ var item = inductionVariable;
3350
+ inductionVariable = inductionVariable + 1 | 0;
3351
+ var tmp$ret$1;
3352
+ // Inline function 'it.unibo.tuprolog.theory.AbstractTheory.get.<anonymous>' call
3353
+ tmp$ret$1 = Companion_getInstance_3().anonymous();
3354
+ tmp0_mapTo.g(tmp$ret$1);
3355
+ }
3356
+ while (!(item === last));
3357
+ tmp$ret$2 = tmp0_mapTo;
3358
+ tmp$ret$3 = tmp$ret$2;
3359
+ var tmp_2 = this.get(tmp.of(tmp_0.ofList(tmp_1, tmp$ret$3), [Companion_getInstance_3().anonymous()]));
3360
+ return map(tmp_2, AbstractTheory$get$lambda_0);
3361
+ };
3362
+ AbstractTheory.prototype.getByIndicator = function (indicator) {
3363
+ return this.e1s(indicator);
3364
+ };
3365
+ AbstractTheory.prototype.g1s = function (indicator) {
3366
+ // Inline function 'kotlin.require' call
3367
+ var tmp0_require = indicator.vy();
3368
+ // Inline function 'kotlin.contracts.contract' call
3369
+ if (!tmp0_require) {
3370
+ var tmp$ret$0;
3371
+ // Inline function 'it.unibo.tuprolog.theory.AbstractTheory.abolish.<anonymous>' call
3372
+ tmp$ret$0 = 'The provided indicator is not well formed: ' + indicator;
3373
+ var message = tmp$ret$0;
3374
+ throw IllegalArgumentException_init_$Create$(toString(message));
3375
+ }
3376
+ return this.retractAllByHead(Companion_getInstance_4().template(ensureNotNull(indicator.q10()), ensureNotNull(indicator.r10()))).h1s();
3377
+ };
3378
+ AbstractTheory.prototype.abolish = function (indicator) {
3379
+ return this.g1s(indicator);
3380
+ };
3381
+ AbstractTheory.prototype.toString = function () {
3382
+ var tmp = getKClassFromExpression(this).kd();
3383
+ var tmp_0 = this.t1l();
3384
+ return '' + tmp + '{ ' + joinToString$default(tmp_0, '. ', null, null, 0, null, null, 62, null) + ' }';
3385
+ };
3386
+ AbstractTheory.prototype.i1s = function (asPrologText) {
3387
+ var tmp;
3388
+ if (asPrologText) {
3389
+ var tmp_0 = this.t1l();
3390
+ tmp = joinToString$default(tmp_0, '.\n', '', '.\n', 0, null, null, 56, null);
3391
+ } else {
3392
+ tmp = this.toString();
3393
+ }
3394
+ return tmp;
3395
+ };
3396
+ AbstractTheory.prototype.toStringAsProlog = function (asPrologText) {
3397
+ return this.i1s(asPrologText);
3398
+ };
3399
+ AbstractTheory.prototype.j = function () {
3400
+ return this.t1l().j();
3401
+ };
3402
+ AbstractTheory.prototype.equals = function (other) {
3403
+ if (other == null)
3404
+ return false;
3405
+ if (!(!(other == null) ? isInterface(other, Theory) : false))
3406
+ return false;
3407
+ return this.j1s(other, true);
3408
+ };
3409
+ AbstractTheory.prototype.j1s = function (other, useVarCompleteName) {
3410
+ if (this === other)
3411
+ return true;
3412
+ var i = this.t1l().j();
3413
+ var j = other.t1l().j();
3414
+ while (i.m() ? j.m() : false) {
3415
+ if (!i.p().equalsUsingVarCompleteNames(j.p(), useVarCompleteName)) {
3416
+ return false;
3417
+ }
3418
+ }
3419
+ return i.m() === j.m();
3420
+ };
3421
+ AbstractTheory.prototype.equalsUsingVarCompleteNames = function (other, useVarCompleteName) {
3422
+ return this.j1s(other, useVarCompleteName);
3423
+ };
3424
+ AbstractTheory.prototype.hashCode = function () {
3425
+ var tmp$ret$0;
3426
+ // Inline function 'kotlin.hashCode' call
3427
+ var tmp0_hashCode = getKClass(AbstractTheory).kd();
3428
+ var tmp0_safe_receiver = tmp0_hashCode;
3429
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : hashCode(tmp0_safe_receiver);
3430
+ tmp$ret$0 = tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs;
3431
+ var base = tmp$ret$0;
3432
+ var result = base ^ (base >>> 32 | 0);
3433
+ var tmp0_iterator = this.t1l().j();
3434
+ while (tmp0_iterator.m()) {
3435
+ var clause = tmp0_iterator.p();
3436
+ result = imul(31, result) + clause.hashCode() | 0;
3437
+ }
3438
+ return result;
3439
+ };
3440
+ AbstractTheory.prototype.o = function () {
3441
+ var i = new Long(0, 0);
3442
+ var iter = this.j();
3443
+ while (iter.m()) {
3444
+ iter.p();
3445
+ var tmp0 = i;
3446
+ i = tmp0.gh();
3447
+ }
3448
+ return i;
3449
+ };
3450
+ AbstractTheory.prototype.o1l = function () {
3451
+ return !this.k1s();
3452
+ };
3453
+ AbstractTheory.prototype.k1s = function () {
3454
+ return this.j().m();
3455
+ };
3456
+ AbstractTheory.prototype.l1s = function (unificator) {
3457
+ var tmp;
3458
+ if (!equals(unificator, this.k1l())) {
3459
+ var tmp_0 = asSequence(this.t1l());
3460
+ tmp = this.m1s(tmp_0, null, unificator, 2, null);
3461
+ } else {
3462
+ tmp = this;
3463
+ }
3464
+ return tmp;
3465
+ };
3466
+ AbstractTheory.prototype.setUnificator = function (unificator) {
3467
+ return this.l1s(unificator);
3468
+ };
3469
+ AbstractTheory.prototype.n1s = function (theory) {
3470
+ var tmp;
3471
+ if (theory.k1s()) {
3472
+ var tmp_0 = plus_0(asSequence(this.t1l()), TheoryUtils_getInstance().o1s(asSequence(theory.t1l())));
3473
+ tmp = this.m1s(tmp_0, null, null, 6, null);
3474
+ } else {
3475
+ tmp = this;
3476
+ }
3477
+ return tmp;
3478
+ };
3479
+ AbstractTheory.prototype.plusTheory = function (theory) {
3480
+ return this.n1s(theory);
3481
+ };
3482
+ AbstractTheory.prototype.p1s = function (clause) {
3483
+ var tmp = plus_0(TheoryUtils_getInstance().q1s([clause]), asSequence(this.t1l()));
3484
+ return this.m1s(tmp, null, null, 6, null);
3485
+ };
3486
+ AbstractTheory.prototype.assertA = function (clause) {
3487
+ return this.p1s(clause);
3488
+ };
3489
+ AbstractTheory.prototype.r1s = function (clauses) {
3490
+ var tmp = plus_0(TheoryUtils_getInstance().o1s(asSequence(clauses)), asSequence(this.t1l()));
3491
+ return this.m1s(tmp, null, null, 6, null);
3492
+ };
3493
+ AbstractTheory.prototype.assertAIterable = function (clauses) {
3494
+ return this.r1s(clauses);
3495
+ };
3496
+ AbstractTheory.prototype.s1s = function (clauses) {
3497
+ var tmp = plus_0(TheoryUtils_getInstance().o1s(clauses), asSequence(this.t1l()));
3498
+ return this.m1s(tmp, null, null, 6, null);
3499
+ };
3500
+ AbstractTheory.prototype.assertASequence = function (clauses) {
3501
+ return this.s1s(clauses);
3502
+ };
3503
+ AbstractTheory.prototype.t1s = function (clause) {
3504
+ var tmp = plus_0(asSequence(this.t1l()), TheoryUtils_getInstance().o1s(sequenceOf([clause])));
3505
+ return this.m1s(tmp, null, null, 6, null);
3506
+ };
3507
+ AbstractTheory.prototype.assertZ = function (clause) {
3508
+ return this.t1s(clause);
3509
+ };
3510
+ AbstractTheory.prototype.u1s = function (clauses) {
3511
+ var tmp = plus_0(asSequence(this.t1l()), asSequence(TheoryUtils_getInstance().r1m(clauses)));
3512
+ return this.m1s(tmp, null, null, 6, null);
3513
+ };
3514
+ AbstractTheory.prototype.assertZIterable = function (clauses) {
3515
+ return this.u1s(clauses);
3516
+ };
3517
+ AbstractTheory.prototype.v1s = function (clauses) {
3518
+ var tmp = plus_0(asSequence(this.t1l()), TheoryUtils_getInstance().o1s(clauses));
3519
+ return this.m1s(tmp, null, null, 6, null);
3520
+ };
3521
+ AbstractTheory.prototype.assertZSequence = function (clauses) {
3522
+ return this.v1s(clauses);
3523
+ };
3524
+ AbstractTheory.prototype.m1s = function (clauses, tags, unificator, $mask0, $handler) {
3525
+ if (!(($mask0 & 2) === 0))
3526
+ tags = this.kt();
3527
+ if (!(($mask0 & 4) === 0))
3528
+ unificator = this.k1l();
3529
+ return $handler == null ? this.w1s(clauses, tags, unificator) : $handler(clauses, tags, unificator);
3530
+ };
3531
+ AbstractTheory.prototype.x1s = function (clauses) {
3532
+ return this.y1s(asIterable(clauses));
3533
+ };
3534
+ AbstractTheory.prototype.retractSequence = function (clauses) {
3535
+ return this.x1s(clauses);
3536
+ };
3537
+ AbstractTheory.prototype.z1s = function () {
3538
+ return this;
3539
+ };
3540
+ AbstractTheory.prototype.clone = function () {
3541
+ return this.z1s();
3542
+ };
3543
+ function Companion_4() {
3544
+ Companion_instance_4 = this;
3545
+ }
3546
+ Companion_4.prototype.empty = function (unificator) {
3547
+ return this.indexedOfIterable(unificator, emptyList());
3548
+ };
3549
+ Companion_4.prototype.of = function (unificator, clause) {
3550
+ return this.indexedOf(unificator, clause.slice());
3551
+ };
3552
+ Companion_4.prototype.ofIterable = function (unificator, clauses) {
3553
+ return this.indexedOfIterable(unificator, clauses);
3554
+ };
3555
+ Companion_4.prototype.ofSequence = function (unificator, clauses) {
3556
+ return this.indexedOfSequence(unificator, clauses);
3557
+ };
3558
+ Companion_4.prototype.ofScopes = function (unificator, clauses) {
3559
+ return this.indexedOfScopes(unificator, clauses.slice());
3560
+ };
3561
+ Companion_4.prototype.emptyIndexed = function (unificator) {
3562
+ return this.indexedOfIterable(unificator, emptyList());
3563
+ };
3564
+ Companion_4.prototype.indexedOf = function (unificator, clause) {
3565
+ return this.indexedOfIterable(unificator, asIterable_0(clause));
3566
+ };
3567
+ Companion_4.prototype.indexedOfScopes = function (unificator, clauses) {
3568
+ var tmp$ret$2;
3569
+ // Inline function 'kotlin.collections.map' call
3570
+ var tmp$ret$1;
3571
+ // Inline function 'kotlin.collections.mapTo' call
3572
+ var tmp0_mapTo = ArrayList_init_$Create$(clauses.length);
3573
+ var indexedObject = clauses;
3574
+ var inductionVariable = 0;
3575
+ var last = indexedObject.length;
3576
+ while (inductionVariable < last) {
3577
+ var item = indexedObject[inductionVariable];
3578
+ inductionVariable = inductionVariable + 1 | 0;
3579
+ var tmp$ret$0;
3580
+ // Inline function 'it.unibo.tuprolog.theory.Companion.indexedOf.<anonymous>' call
3581
+ tmp$ret$0 = Companion_getInstance().emptyWithFunction(item);
3582
+ tmp0_mapTo.g(tmp$ret$0);
3583
+ }
3584
+ tmp$ret$1 = tmp0_mapTo;
3585
+ tmp$ret$2 = tmp$ret$1;
3586
+ return this.indexedOfIterable(unificator, tmp$ret$2);
3587
+ };
3588
+ Companion_4.prototype.indexedOfSequence = function (unificator, clauses) {
3589
+ return this.indexedOfIterable(unificator, asIterable(clauses));
3590
+ };
3591
+ Companion_4.prototype.indexedOfIterable = function (unificator, clauses) {
3592
+ return MutableIndexedTheory_init_$Create$(unificator, clauses, null, 4, null);
3593
+ };
3594
+ Companion_4.prototype.emptyListed = function (unificator) {
3595
+ return this.listedOfSequence(unificator, emptySequence());
3596
+ };
3597
+ Companion_4.prototype.listedOf = function (unificator, clause) {
3598
+ return this.listedOfIterable(unificator, asIterable_0(clause));
3599
+ };
3600
+ Companion_4.prototype.listedOfScopes = function (unificator, clause) {
3601
+ var tmp$ret$2;
3602
+ // Inline function 'kotlin.collections.map' call
3603
+ var tmp$ret$1;
3604
+ // Inline function 'kotlin.collections.mapTo' call
3605
+ var tmp0_mapTo = ArrayList_init_$Create$(clause.length);
3606
+ var indexedObject = clause;
3607
+ var inductionVariable = 0;
3608
+ var last = indexedObject.length;
3609
+ while (inductionVariable < last) {
3610
+ var item = indexedObject[inductionVariable];
3611
+ inductionVariable = inductionVariable + 1 | 0;
3612
+ var tmp$ret$0;
3613
+ // Inline function 'it.unibo.tuprolog.theory.Companion.listedOf.<anonymous>' call
3614
+ tmp$ret$0 = Companion_getInstance().emptyWithFunction(item);
3615
+ tmp0_mapTo.g(tmp$ret$0);
3616
+ }
3617
+ tmp$ret$1 = tmp0_mapTo;
3618
+ tmp$ret$2 = tmp$ret$1;
3619
+ return this.listedOfIterable(unificator, tmp$ret$2);
3620
+ };
3621
+ Companion_4.prototype.listedOfSequence = function (unificator, clauses) {
3622
+ return this.listedOfIterable(unificator, asIterable(clauses));
3623
+ };
3624
+ Companion_4.prototype.listedOfIterable = function (unificator, clauses) {
3625
+ return MutableListedTheory_init_$Create$(unificator, clauses, null, 4, null);
3626
+ };
3627
+ var Companion_instance_4;
3628
+ function Companion_getInstance_12() {
3629
+ if (Companion_instance_4 == null)
3630
+ new Companion_4();
3631
+ return Companion_instance_4;
3632
+ }
3633
+ function MutableTheory() {
3634
+ }
3635
+ function Success_0(theory, clauses) {
3636
+ RetractResult.call(this);
3637
+ this.h1t_1 = theory;
3638
+ this.i1t_1 = clauses;
3639
+ }
3640
+ Success_0.prototype.h1s = function () {
3641
+ return this.h1t_1;
3642
+ };
3643
+ Success_0.prototype.t1l = function () {
3644
+ return this.i1t_1;
3645
+ };
3646
+ Success_0.prototype.n1m = function () {
3647
+ return first_0(this.i1t_1);
3648
+ };
3649
+ Success_0.prototype.toString = function () {
3650
+ return 'Success(theory=' + this.h1t_1 + ', clauses=' + this.i1t_1 + ')';
3651
+ };
3652
+ Success_0.prototype.hashCode = function () {
3653
+ var result = hashCode(this.h1t_1);
3654
+ result = imul(result, 31) + hashCode(this.i1t_1) | 0;
3655
+ return result;
3656
+ };
3657
+ Success_0.prototype.equals = function (other) {
3658
+ if (this === other)
3659
+ return true;
3660
+ if (!(other instanceof Success_0))
3661
+ return false;
3662
+ var tmp0_other_with_cast = other instanceof Success_0 ? other : THROW_CCE();
3663
+ if (!equals(this.h1t_1, tmp0_other_with_cast.h1t_1))
3664
+ return false;
3665
+ if (!equals(this.i1t_1, tmp0_other_with_cast.i1t_1))
3666
+ return false;
3667
+ return true;
3668
+ };
3669
+ function Failure_0(theory) {
3670
+ RetractResult.call(this);
3671
+ this.j1t_1 = theory;
3672
+ }
3673
+ Failure_0.prototype.h1s = function () {
3674
+ return this.j1t_1;
3675
+ };
3676
+ Failure_0.prototype.t1l = function () {
3677
+ return null;
3678
+ };
3679
+ Failure_0.prototype.n1m = function () {
3680
+ return null;
3681
+ };
3682
+ Failure_0.prototype.toString = function () {
3683
+ return 'Failure(theory=' + this.j1t_1 + ')';
3684
+ };
3685
+ Failure_0.prototype.hashCode = function () {
3686
+ return hashCode(this.j1t_1);
3687
+ };
3688
+ Failure_0.prototype.equals = function (other) {
3689
+ if (this === other)
3690
+ return true;
3691
+ if (!(other instanceof Failure_0))
3692
+ return false;
3693
+ var tmp0_other_with_cast = other instanceof Failure_0 ? other : THROW_CCE();
3694
+ if (!equals(this.j1t_1, tmp0_other_with_cast.j1t_1))
3695
+ return false;
3696
+ return true;
3697
+ };
3698
+ function RetractResult() {
3699
+ }
3700
+ Object.defineProperty(RetractResult.prototype, 'theory', {
3701
+ configurable: true,
3702
+ get: function () {
3703
+ return this.h1s();
3704
+ }
3705
+ });
3706
+ Object.defineProperty(RetractResult.prototype, 'clauses', {
3707
+ configurable: true,
3708
+ get: function () {
3709
+ return this.t1l();
3710
+ }
3711
+ });
3712
+ Object.defineProperty(RetractResult.prototype, 'firstClause', {
3713
+ configurable: true,
3714
+ get: function () {
3715
+ return this.n1m();
3716
+ }
3717
+ });
3718
+ function Companion_5() {
3719
+ Companion_instance_5 = this;
3720
+ }
3721
+ Companion_5.prototype.empty = function (unificator) {
3722
+ return this.indexedOfSequence(unificator, emptySequence());
3723
+ };
3724
+ Companion_5.prototype.emptyWithDefaultUnificator = function () {
3725
+ return this.empty(Companion_getInstance_6().h1l());
3726
+ };
3727
+ Companion_5.prototype.of = function (unificator, clause) {
3728
+ return this.indexedOf(unificator, clause.slice());
3729
+ };
3730
+ Companion_5.prototype.ofWithDefaultUnificator = function (clause) {
3731
+ return this.indexedOf(Companion_getInstance_6().h1l(), clause.slice());
3732
+ };
3733
+ Companion_5.prototype.ofIterable = function (unificator, clauses) {
3734
+ return this.indexedOfIterable(unificator, clauses);
3735
+ };
3736
+ Companion_5.prototype.ofIterableWithDefaultUnificator = function (clauses) {
3737
+ return this.indexedOfIterable(Companion_getInstance_6().h1l(), clauses);
3738
+ };
3739
+ Companion_5.prototype.ofSequence = function (unificator, clauses) {
3740
+ return this.indexedOfSequence(unificator, clauses);
3741
+ };
3742
+ Companion_5.prototype.ofSequenceWithDefaultUnificator = function (clauses) {
3743
+ return this.indexedOfSequence(Companion_getInstance_6().h1l(), clauses);
3744
+ };
3745
+ Companion_5.prototype.ofScopes = function (unificator, clauses) {
3746
+ return this.indexedOfScopes(unificator, clauses.slice());
3747
+ };
3748
+ Companion_5.prototype.ofScopesWithDefaultUnificator = function (clauses) {
3749
+ return this.indexedOfScopes(Companion_getInstance_6().h1l(), clauses.slice());
3750
+ };
3751
+ Companion_5.prototype.emptyIndexed = function (unificator) {
3752
+ return this.indexedOfIterable(unificator, emptyList());
3753
+ };
3754
+ Companion_5.prototype.indexedOf = function (unificator, clause) {
3755
+ return this.indexedOfIterable(unificator, asIterable_0(clause));
3756
+ };
3757
+ Companion_5.prototype.indexedOfScopes = function (unificator, clauses) {
3758
+ var tmp$ret$2;
3759
+ // Inline function 'kotlin.collections.map' call
3760
+ var tmp$ret$1;
3761
+ // Inline function 'kotlin.collections.mapTo' call
3762
+ var tmp0_mapTo = ArrayList_init_$Create$(clauses.length);
3763
+ var indexedObject = clauses;
3764
+ var inductionVariable = 0;
3765
+ var last = indexedObject.length;
3766
+ while (inductionVariable < last) {
3767
+ var item = indexedObject[inductionVariable];
3768
+ inductionVariable = inductionVariable + 1 | 0;
3769
+ var tmp$ret$0;
3770
+ // Inline function 'it.unibo.tuprolog.theory.Companion.indexedOf.<anonymous>' call
3771
+ tmp$ret$0 = Companion_getInstance().emptyWithFunction(item);
3772
+ tmp0_mapTo.g(tmp$ret$0);
3773
+ }
3774
+ tmp$ret$1 = tmp0_mapTo;
3775
+ tmp$ret$2 = tmp$ret$1;
3776
+ return this.indexedOfIterable(unificator, tmp$ret$2);
3777
+ };
3778
+ Companion_5.prototype.indexedOfSequence = function (unificator, clauses) {
3779
+ return this.indexedOfIterable(unificator, asIterable(clauses));
3780
+ };
3781
+ Companion_5.prototype.indexedOfIterable = function (unificator, clauses) {
3782
+ return IndexedTheory_init_$Create$(unificator, clauses, null, 4, null);
3783
+ };
3784
+ Companion_5.prototype.emptyListed = function (unificator) {
3785
+ return this.listedOfSequence(unificator, emptySequence());
3786
+ };
3787
+ Companion_5.prototype.listedOf = function (unificator, clause) {
3788
+ return this.listedOfIterable(unificator, asIterable_0(clause));
3789
+ };
3790
+ Companion_5.prototype.listedOfScopes = function (unificator, clause) {
3791
+ var tmp$ret$2;
3792
+ // Inline function 'kotlin.collections.map' call
3793
+ var tmp$ret$1;
3794
+ // Inline function 'kotlin.collections.mapTo' call
3795
+ var tmp0_mapTo = ArrayList_init_$Create$(clause.length);
3796
+ var indexedObject = clause;
3797
+ var inductionVariable = 0;
3798
+ var last = indexedObject.length;
3799
+ while (inductionVariable < last) {
3800
+ var item = indexedObject[inductionVariable];
3801
+ inductionVariable = inductionVariable + 1 | 0;
3802
+ var tmp$ret$0;
3803
+ // Inline function 'it.unibo.tuprolog.theory.Companion.listedOf.<anonymous>' call
3804
+ tmp$ret$0 = Companion_getInstance().emptyWithFunction(item);
3805
+ tmp0_mapTo.g(tmp$ret$0);
3806
+ }
3807
+ tmp$ret$1 = tmp0_mapTo;
3808
+ tmp$ret$2 = tmp$ret$1;
3809
+ return this.listedOfIterable(unificator, tmp$ret$2);
3810
+ };
3811
+ Companion_5.prototype.listedOfSequence = function (unificator, clauses) {
3812
+ return this.listedOfIterable(unificator, asIterable(clauses));
3813
+ };
3814
+ Companion_5.prototype.listedOfIterable = function (unificator, clauses) {
3815
+ return ListedTheory_init_$Create$(unificator, clauses, null, 4, null);
3816
+ };
3817
+ var Companion_instance_5;
3818
+ function Companion_getInstance_13() {
3819
+ if (Companion_instance_5 == null)
3820
+ new Companion_5();
3821
+ return Companion_instance_5;
3822
+ }
3823
+ function Theory$_get_rules_$lambda_c39n1s(it) {
3824
+ return it.asRule();
3825
+ }
3826
+ function Theory$_get_directives_$lambda_zbsn17(it) {
3827
+ return it.asDirective();
3828
+ }
3829
+ function Theory() {
3830
+ }
3831
+ function actualCheck($this, clauses) {
3832
+ // Inline function 'kotlin.require' call
3833
+ var tmp$ret$1;
3834
+ $l$block: {
3835
+ // Inline function 'kotlin.sequences.all' call
3836
+ var tmp0_iterator = clauses.j();
3837
+ while (tmp0_iterator.m()) {
3838
+ var element = tmp0_iterator.p();
3839
+ var tmp$ret$0;
3840
+ // Inline function 'it.unibo.tuprolog.theory.TheoryUtils.actualCheck.<anonymous>' call
3841
+ tmp$ret$0 = element.vy();
3842
+ if (!tmp$ret$0) {
3843
+ tmp$ret$1 = false;
3844
+ break $l$block;
3845
+ }
3846
+ }
3847
+ tmp$ret$1 = true;
3848
+ }
3849
+ var tmp0_require = tmp$ret$1;
3850
+ // Inline function 'kotlin.contracts.contract' call
3851
+ if (!tmp0_require) {
3852
+ var tmp$ret$2;
3853
+ // Inline function 'it.unibo.tuprolog.theory.TheoryUtils.actualCheck.<anonymous>' call
3854
+ tmp$ret$2 = "ClauseDatabase can contain only well formed clauses: these aren't " + ('' + toList(filterNot(clauses, TheoryUtils$actualCheck$lambda)));
3855
+ var message = tmp$ret$2;
3856
+ throw IllegalArgumentException_init_$Create$(toString(message));
3857
+ }
3858
+ }
3859
+ function TheoryUtils$actualCheck$lambda(it) {
3860
+ return it.vy();
3861
+ }
3862
+ function TheoryUtils() {
3863
+ TheoryUtils_instance = this;
3864
+ }
3865
+ TheoryUtils.prototype.g1m = function (clause) {
3866
+ var tmp$ret$1;
3867
+ // Inline function 'kotlin.also' call
3868
+ // Inline function 'kotlin.contracts.contract' call
3869
+ // Inline function 'it.unibo.tuprolog.theory.TheoryUtils.checkClauseCorrect.<anonymous>' call
3870
+ // Inline function 'kotlin.require' call
3871
+ var tmp0_require = clause.vy();
3872
+ // Inline function 'kotlin.contracts.contract' call
3873
+ if (!tmp0_require) {
3874
+ var tmp$ret$0;
3875
+ // Inline function 'it.unibo.tuprolog.theory.TheoryUtils.checkClauseCorrect.<anonymous>.<anonymous>' call
3876
+ tmp$ret$0 = 'ClauseDatabase can contain only well formed clauses: ' + ("this isn't " + clause);
3877
+ var message = tmp$ret$0;
3878
+ throw IllegalArgumentException_init_$Create$(toString(message));
3879
+ }
3880
+ tmp$ret$1 = clause;
3881
+ return tmp$ret$1;
3882
+ };
3883
+ TheoryUtils.prototype.q1s = function (clauses) {
3884
+ var tmp$ret$0;
3885
+ // Inline function 'kotlin.also' call
3886
+ var tmp0_also = asSequence_0(clauses);
3887
+ // Inline function 'kotlin.contracts.contract' call
3888
+ // Inline function 'it.unibo.tuprolog.theory.TheoryUtils.checkClausesCorrect.<anonymous>' call
3889
+ actualCheck(TheoryUtils_getInstance(), tmp0_also);
3890
+ tmp$ret$0 = tmp0_also;
3891
+ return tmp$ret$0;
3892
+ };
3893
+ TheoryUtils.prototype.r1m = function (clauses) {
3894
+ var tmp$ret$0;
3895
+ // Inline function 'kotlin.also' call
3896
+ // Inline function 'kotlin.contracts.contract' call
3897
+ // Inline function 'it.unibo.tuprolog.theory.TheoryUtils.checkClausesCorrect.<anonymous>' call
3898
+ actualCheck(TheoryUtils_getInstance(), asSequence(clauses));
3899
+ tmp$ret$0 = clauses;
3900
+ return tmp$ret$0;
3901
+ };
3902
+ TheoryUtils.prototype.o1s = function (clauses) {
3903
+ var tmp$ret$0;
3904
+ // Inline function 'kotlin.also' call
3905
+ // Inline function 'kotlin.contracts.contract' call
3906
+ // Inline function 'it.unibo.tuprolog.theory.TheoryUtils.checkClausesCorrect.<anonymous>' call
3907
+ actualCheck(TheoryUtils_getInstance(), clauses);
3908
+ tmp$ret$0 = clauses;
3909
+ return tmp$ret$0;
3910
+ };
3911
+ var TheoryUtils_instance;
3912
+ function TheoryUtils_getInstance() {
3913
+ if (TheoryUtils_instance == null)
3914
+ new TheoryUtils();
3915
+ return TheoryUtils_instance;
3916
+ }
3917
+ function _no_name_provided__qut3iv(this$0) {
3918
+ this.k1t_1 = this$0;
3919
+ }
3920
+ _no_name_provided__qut3iv.prototype.j = function () {
3921
+ var tmp$ret$0;
3922
+ // Inline function 'it.unibo.tuprolog.theory.impl.AbstractIndexedTheory.<get-clauses>.<anonymous>' call
3923
+ tmp$ret$0 = this.k1t_1.n1t().j();
3924
+ return tmp$ret$0;
3925
+ };
3926
+ function AbstractIndexedTheory(queue, tags) {
3927
+ AbstractTheory.call(this, tags);
3928
+ this.m1t_1 = queue;
3929
+ }
3930
+ AbstractIndexedTheory.prototype.k1l = function () {
3931
+ return this.n1t().k1l();
3932
+ };
3933
+ AbstractIndexedTheory.prototype.n1t = function () {
3934
+ return this.m1t_1;
3935
+ };
3936
+ AbstractIndexedTheory.prototype.m1l = function () {
3937
+ return this.n1t().l1l();
3938
+ };
3939
+ AbstractIndexedTheory.prototype.n1l = function () {
3940
+ return this.n1t().n1l();
3941
+ };
3942
+ AbstractIndexedTheory.prototype.t1l = function () {
3943
+ var tmp$ret$0;
3944
+ // Inline function 'kotlin.collections.Iterable' call
3945
+ tmp$ret$0 = new _no_name_provided__qut3iv(this);
3946
+ return tmp$ret$0;
3947
+ };
3948
+ AbstractIndexedTheory.prototype.r1l = function (clause) {
3949
+ return this.n1t().r1l(clause);
3950
+ };
3951
+ AbstractIndexedTheory.prototype.get = function (clause) {
3952
+ return this.r1l(clause);
3953
+ };
3954
+ AbstractIndexedTheory.prototype.o = function () {
3955
+ return toLong(this.n1t().o());
3956
+ };
3957
+ AbstractIndexedTheory.prototype.o1l = function () {
3958
+ return this.n1t().isEmpty();
3959
+ };
3960
+ AbstractIndexedTheory.prototype.k1s = function () {
3961
+ return !this.o1l();
3962
+ };
3963
+ function AbstractListedTheory(unificator, clauses, tags) {
3964
+ AbstractTheory.call(this, tags);
3965
+ this.p1t_1 = clauses;
3966
+ this.q1t_1 = unificator;
3967
+ }
3968
+ AbstractListedTheory.prototype.t1l = function () {
3969
+ return this.p1t_1;
3970
+ };
3971
+ AbstractListedTheory.prototype.r1t = function (_set____db54di) {
3972
+ this.q1t_1 = _set____db54di;
3973
+ };
3974
+ AbstractListedTheory.prototype.k1l = function () {
3975
+ return this.q1t_1;
3976
+ };
3977
+ AbstractListedTheory.prototype.r1l = function (clause) {
3978
+ var tmp$ret$2;
3979
+ // Inline function 'kotlin.collections.filter' call
3980
+ var tmp0_filter = this.t1l();
3981
+ var tmp$ret$1;
3982
+ // Inline function 'kotlin.collections.filterTo' call
3983
+ var tmp0_filterTo = ArrayList_init_$Create$_0();
3984
+ var tmp0_iterator = tmp0_filter.j();
3985
+ while (tmp0_iterator.m()) {
3986
+ var element = tmp0_iterator.p();
3987
+ var tmp$ret$0;
3988
+ // Inline function 'it.unibo.tuprolog.theory.impl.AbstractListedTheory.get.<anonymous>' call
3989
+ tmp$ret$0 = this.k1l().match(element, clause);
3990
+ if (tmp$ret$0) {
3991
+ tmp0_filterTo.g(element);
3992
+ }
3993
+ }
3994
+ tmp$ret$1 = tmp0_filterTo;
3995
+ tmp$ret$2 = tmp$ret$1;
3996
+ return asSequence(tmp$ret$2);
3997
+ };
3998
+ AbstractListedTheory.prototype.get = function (clause) {
3999
+ return this.r1l(clause);
4000
+ };
4001
+ function IndexedTheory_init_$Init$(unificator, clauses, tags, $this) {
4002
+ IndexedTheory.call($this, Companion_getInstance_7().ofIterable(unificator, clauses), tags);
4003
+ TheoryUtils_getInstance().r1m(clauses);
4004
+ return $this;
4005
+ }
4006
+ function IndexedTheory_init_$Init$_0(unificator, clauses, tags, $mask0, $marker, $this) {
4007
+ if (!(($mask0 & 4) === 0))
4008
+ tags = emptyMap();
4009
+ IndexedTheory_init_$Init$(unificator, clauses, tags, $this);
4010
+ return $this;
4011
+ }
4012
+ function IndexedTheory_init_$Create$(unificator, clauses, tags, $mask0, $marker) {
4013
+ return IndexedTheory_init_$Init$_0(unificator, clauses, tags, $mask0, $marker, Object.create(IndexedTheory.prototype));
4014
+ }
4015
+ function IndexedTheory_init_$Init$_1(unificator, clauses, tags, $this) {
4016
+ IndexedTheory_init_$Init$(unificator, asIterable(clauses), tags, $this);
4017
+ return $this;
4018
+ }
4019
+ function IndexedTheory_init_$Create$_0(unificator, clauses, tags) {
4020
+ return IndexedTheory_init_$Init$_1(unificator, clauses, tags, Object.create(IndexedTheory.prototype));
4021
+ }
4022
+ function _get_hashCodeCache__ny3r0q_0($this) {
4023
+ var tmp$ret$0;
4024
+ // Inline function 'kotlin.getValue' call
4025
+ var tmp0_getValue = hashCodeCache$factory_0();
4026
+ tmp$ret$0 = $this.u1t_1.b1();
4027
+ return tmp$ret$0;
4028
+ }
4029
+ function _get_sizeCache__6eswog($this) {
4030
+ var tmp$ret$0;
4031
+ // Inline function 'kotlin.getValue' call
4032
+ var tmp0_getValue = sizeCache$factory();
4033
+ tmp$ret$0 = $this.v1t_1.b1();
4034
+ return tmp$ret$0;
4035
+ }
4036
+ function IndexedTheory$hashCodeCache$delegate$lambda(this$0) {
4037
+ return function () {
4038
+ return AbstractIndexedTheory.prototype.hashCode.call(this$0);
4039
+ };
4040
+ }
4041
+ function IndexedTheory$sizeCache$delegate$lambda(this$0) {
4042
+ return function () {
4043
+ return AbstractIndexedTheory.prototype.o.call(this$0);
4044
+ };
4045
+ }
4046
+ function IndexedTheory(queue, tags) {
4047
+ AbstractIndexedTheory.call(this, queue, tags);
4048
+ var tmp = this;
4049
+ tmp.u1t_1 = lazy(IndexedTheory$hashCodeCache$delegate$lambda(this));
4050
+ var tmp_0 = this;
4051
+ tmp_0.v1t_1 = lazy(IndexedTheory$sizeCache$delegate$lambda(this));
4052
+ }
4053
+ IndexedTheory.prototype.w1s = function (clauses, tags, unificator) {
4054
+ return IndexedTheory_init_$Create$_0(unificator, clauses, tags);
4055
+ };
4056
+ IndexedTheory.prototype.e1t = function (clause) {
4057
+ var newTheory = Companion_getInstance_7().ofIterable(this.k1l(), this.t1l());
4058
+ var retracted = newTheory.retrieveFirst(clause);
4059
+ return retracted.o1m() ? new Failure_0(this) : new Success_0(new IndexedTheory(retracted.m1m(), this.kt()), ensureNotNull(retracted.t1l()));
4060
+ };
4061
+ IndexedTheory.prototype.retract = function (clause) {
4062
+ return this.e1t(clause);
4063
+ };
4064
+ IndexedTheory.prototype.n1s = function (theory) {
4065
+ return this.o1l() ? theory.toImmutableTheory() : theory.o1l() ? this : AbstractIndexedTheory.prototype.n1s.call(this, theory);
4066
+ };
4067
+ IndexedTheory.prototype.plusTheory = function (theory) {
4068
+ return this.n1s(theory);
4069
+ };
4070
+ IndexedTheory.prototype.b1t = function () {
4071
+ return Companion_getInstance_12().indexedOfIterable(this.k1l(), this);
4072
+ };
4073
+ IndexedTheory.prototype.toMutableTheory = function () {
4074
+ return this.b1t();
4075
+ };
4076
+ IndexedTheory.prototype.y1s = function (clauses) {
4077
+ var newTheory = Companion_getInstance_8().ofIterable(this.k1l(), this.t1l());
4078
+ var removed = dequeOf([]);
4079
+ var tmp0_iterator = clauses.j();
4080
+ while (tmp0_iterator.m()) {
4081
+ var clause = tmp0_iterator.p();
4082
+ var result = newTheory.j1m(clause);
4083
+ if (result.q12()) {
4084
+ removed.t(ensureNotNull(result.t1l()));
4085
+ }
4086
+ }
4087
+ var tmp;
4088
+ if (removed.d()) {
4089
+ tmp = new Failure_0(this);
4090
+ } else {
4091
+ tmp = new Success_0(new IndexedTheory(newTheory, this.kt()), removed);
4092
+ }
4093
+ return tmp;
4094
+ };
4095
+ IndexedTheory.prototype.retractIterable = function (clauses) {
4096
+ return this.y1s(clauses);
4097
+ };
4098
+ IndexedTheory.prototype.c1m = function (clause) {
4099
+ var newTheory = Companion_getInstance_7().ofIterable(this.k1l(), this.t1l());
4100
+ var retracted = newTheory.b1m(clause);
4101
+ return retracted.o1m() ? new Failure_0(this) : new Success_0(new IndexedTheory(retracted.m1m(), this.kt()), ensureNotNull(retracted.t1l()));
4102
+ };
4103
+ IndexedTheory.prototype.retractAll = function (clause) {
4104
+ return this.c1m(clause);
4105
+ };
4106
+ IndexedTheory.prototype.hashCode = function () {
4107
+ return _get_hashCodeCache__ny3r0q_0(this);
4108
+ };
4109
+ IndexedTheory.prototype.o = function () {
4110
+ return _get_sizeCache__6eswog(this);
4111
+ };
4112
+ IndexedTheory.prototype.o12 = function (tags) {
4113
+ return tags === this.kt() ? this : new IndexedTheory(this.n1t(), tags);
4114
+ };
4115
+ IndexedTheory.prototype.resetTags = function (tags) {
4116
+ return this.o12(tags);
4117
+ };
4118
+ function hashCodeCache$factory_0() {
4119
+ return getPropertyCallableRef('hashCodeCache', 1, KProperty1, function (receiver) {
4120
+ return _get_hashCodeCache__ny3r0q_0(receiver);
4121
+ }, null);
4122
+ }
4123
+ function sizeCache$factory() {
4124
+ return getPropertyCallableRef('sizeCache', 1, KProperty1, function (receiver) {
4125
+ return _get_sizeCache__6eswog(receiver);
4126
+ }, null);
4127
+ }
4128
+ function ListedTheory_init_$Init$(unificator, clauses, tags, $this) {
4129
+ ListedTheory.call($this, unificator, toList_0(clauses), tags);
4130
+ TheoryUtils_getInstance().r1m(clauses);
4131
+ return $this;
4132
+ }
4133
+ function ListedTheory_init_$Init$_0(unificator, clauses, tags, $mask0, $marker, $this) {
4134
+ if (!(($mask0 & 4) === 0))
4135
+ tags = emptyMap();
4136
+ ListedTheory_init_$Init$(unificator, clauses, tags, $this);
4137
+ return $this;
4138
+ }
4139
+ function ListedTheory_init_$Create$(unificator, clauses, tags, $mask0, $marker) {
4140
+ return ListedTheory_init_$Init$_0(unificator, clauses, tags, $mask0, $marker, Object.create(ListedTheory.prototype));
4141
+ }
4142
+ function ListedTheory_init_$Init$_1(unificator, clauses, tags, $this) {
4143
+ ListedTheory.call($this, unificator, toList(clauses), tags);
4144
+ TheoryUtils_getInstance().o1s(clauses);
4145
+ return $this;
4146
+ }
4147
+ function ListedTheory_init_$Create$_0(unificator, clauses, tags) {
4148
+ return ListedTheory_init_$Init$_1(unificator, clauses, tags, Object.create(ListedTheory.prototype));
4149
+ }
4150
+ function _get_hashCodeCache__ny3r0q_1($this) {
4151
+ var tmp$ret$0;
4152
+ // Inline function 'kotlin.getValue' call
4153
+ var tmp0_getValue = hashCodeCache$factory_1();
4154
+ tmp$ret$0 = $this.z1t_1.b1();
4155
+ return tmp$ret$0;
4156
+ }
4157
+ function _get_sizeCache__6eswog_0($this) {
4158
+ var tmp$ret$0;
4159
+ // Inline function 'kotlin.getValue' call
4160
+ var tmp0_getValue = sizeCache$factory_0();
4161
+ tmp$ret$0 = $this.a1u_1.b1();
4162
+ return tmp$ret$0;
4163
+ }
4164
+ function ListedTheory$hashCodeCache$delegate$lambda(this$0) {
4165
+ return function () {
4166
+ return AbstractListedTheory.prototype.hashCode.call(this$0);
4167
+ };
4168
+ }
4169
+ function ListedTheory$sizeCache$delegate$lambda(this$0) {
4170
+ return function () {
4171
+ return AbstractListedTheory.prototype.o.call(this$0);
4172
+ };
4173
+ }
4174
+ function ListedTheory(unificator, clauses, tags) {
4175
+ AbstractListedTheory.call(this, unificator, clauses, tags);
4176
+ var tmp = this;
4177
+ tmp.z1t_1 = lazy(ListedTheory$hashCodeCache$delegate$lambda(this));
4178
+ var tmp_0 = this;
4179
+ tmp_0.a1u_1 = lazy(ListedTheory$sizeCache$delegate$lambda(this));
4180
+ }
4181
+ ListedTheory.prototype.w1s = function (clauses, tags, unificator) {
4182
+ return ListedTheory_init_$Create$_0(unificator, clauses, tags);
4183
+ };
4184
+ ListedTheory.prototype.e1t = function (clause) {
4185
+ var tmp$ret$2;
4186
+ // Inline function 'kotlin.collections.filter' call
4187
+ var tmp0_filter = this.t1l();
4188
+ var tmp$ret$1;
4189
+ // Inline function 'kotlin.collections.filterTo' call
4190
+ var tmp0_filterTo = ArrayList_init_$Create$_0();
4191
+ var tmp0_iterator = tmp0_filter.j();
4192
+ while (tmp0_iterator.m()) {
4193
+ var element = tmp0_iterator.p();
4194
+ var tmp$ret$0;
4195
+ // Inline function 'it.unibo.tuprolog.theory.impl.ListedTheory.retract.<anonymous>' call
4196
+ tmp$ret$0 = this.k1l().match(element, clause);
4197
+ if (tmp$ret$0) {
4198
+ tmp0_filterTo.g(element);
4199
+ }
4200
+ }
4201
+ tmp$ret$1 = tmp0_filterTo;
4202
+ tmp$ret$2 = tmp$ret$1;
4203
+ var retractability = tmp$ret$2;
4204
+ var tmp;
4205
+ if (none_0(retractability)) {
4206
+ tmp = new Failure_0(this);
4207
+ } else {
4208
+ var toBeActuallyRetracted = first(retractability);
4209
+ var tmp$ret$5;
4210
+ // Inline function 'kotlin.collections.filter' call
4211
+ var tmp1_filter = this.t1l();
4212
+ var tmp$ret$4;
4213
+ // Inline function 'kotlin.collections.filterTo' call
4214
+ var tmp0_filterTo_0 = ArrayList_init_$Create$_0();
4215
+ var tmp0_iterator_0 = tmp1_filter.j();
4216
+ while (tmp0_iterator_0.m()) {
4217
+ var element_0 = tmp0_iterator_0.p();
4218
+ var tmp$ret$3;
4219
+ // Inline function 'it.unibo.tuprolog.theory.impl.ListedTheory.retract.<anonymous>' call
4220
+ tmp$ret$3 = !element_0.equals(toBeActuallyRetracted);
4221
+ if (tmp$ret$3) {
4222
+ tmp0_filterTo_0.g(element_0);
4223
+ }
4224
+ }
4225
+ tmp$ret$4 = tmp0_filterTo_0;
4226
+ tmp$ret$5 = tmp$ret$4;
4227
+ var newTheory = tmp$ret$5;
4228
+ tmp = new Success_0(new ListedTheory(this.k1l(), newTheory, this.kt()), listOf_0(toBeActuallyRetracted));
4229
+ }
4230
+ return tmp;
4231
+ };
4232
+ ListedTheory.prototype.retract = function (clause) {
4233
+ return this.e1t(clause);
4234
+ };
4235
+ ListedTheory.prototype.b1t = function () {
4236
+ return Companion_getInstance_12().listedOfIterable(this.k1l(), this);
4237
+ };
4238
+ ListedTheory.prototype.toMutableTheory = function () {
4239
+ return this.b1t();
4240
+ };
4241
+ ListedTheory.prototype.y1s = function (clauses) {
4242
+ var residual = dequeOf_1(this.t1l());
4243
+ var removed = dequeOf([]);
4244
+ var i = residual.j();
4245
+ while (i.m()) {
4246
+ var current = i.p();
4247
+ var tmp$ret$0;
4248
+ $l$block_0: {
4249
+ // Inline function 'kotlin.collections.any' call
4250
+ var tmp;
4251
+ if (isInterface(clauses, Collection)) {
4252
+ tmp = clauses.d();
4253
+ } else {
4254
+ tmp = false;
4255
+ }
4256
+ if (tmp) {
4257
+ tmp$ret$0 = false;
4258
+ break $l$block_0;
4259
+ }
4260
+ var tmp0_iterator = clauses.j();
4261
+ while (tmp0_iterator.m()) {
4262
+ var element = tmp0_iterator.p();
4263
+ var tmp$ret$1;
4264
+ // Inline function 'it.unibo.tuprolog.theory.impl.ListedTheory.retract.<anonymous>' call
4265
+ tmp$ret$1 = this.k1l().match(element, current);
4266
+ if (tmp$ret$1) {
4267
+ tmp$ret$0 = true;
4268
+ break $l$block_0;
4269
+ }
4270
+ }
4271
+ tmp$ret$0 = false;
4272
+ }
4273
+ if (tmp$ret$0) {
4274
+ i.u4();
4275
+ removed.g(current);
4276
+ }
4277
+ }
4278
+ var tmp_0;
4279
+ if (removed.d()) {
4280
+ tmp_0 = new Failure_0(this);
4281
+ } else {
4282
+ tmp_0 = new Success_0(new ListedTheory(this.k1l(), residual, this.kt()), removed);
4283
+ }
4284
+ return tmp_0;
4285
+ };
4286
+ ListedTheory.prototype.retractIterable = function (clauses) {
4287
+ return this.y1s(clauses);
4288
+ };
4289
+ ListedTheory.prototype.c1m = function (clause) {
4290
+ var tmp$ret$2;
4291
+ // Inline function 'kotlin.collections.filter' call
4292
+ var tmp0_filter = this.t1l();
4293
+ var tmp$ret$1;
4294
+ // Inline function 'kotlin.collections.filterTo' call
4295
+ var tmp0_filterTo = ArrayList_init_$Create$_0();
4296
+ var tmp0_iterator = tmp0_filter.j();
4297
+ while (tmp0_iterator.m()) {
4298
+ var element = tmp0_iterator.p();
4299
+ var tmp$ret$0;
4300
+ // Inline function 'it.unibo.tuprolog.theory.impl.ListedTheory.retractAll.<anonymous>' call
4301
+ tmp$ret$0 = this.k1l().match(element, clause);
4302
+ if (tmp$ret$0) {
4303
+ tmp0_filterTo.g(element);
4304
+ }
4305
+ }
4306
+ tmp$ret$1 = tmp0_filterTo;
4307
+ tmp$ret$2 = tmp$ret$1;
4308
+ var retractability = tmp$ret$2;
4309
+ var tmp;
4310
+ if (none_0(retractability)) {
4311
+ tmp = new Failure_0(this);
4312
+ } else {
4313
+ var tmp$ret$4;
4314
+ // Inline function 'kotlin.collections.partition' call
4315
+ var tmp1_partition = toList_0(this.t1l());
4316
+ var first = ArrayList_init_$Create$_0();
4317
+ var second = ArrayList_init_$Create$_0();
4318
+ var tmp0_iterator_0 = tmp1_partition.j();
4319
+ while (tmp0_iterator_0.m()) {
4320
+ var element_0 = tmp0_iterator_0.p();
4321
+ var tmp$ret$3;
4322
+ // Inline function 'it.unibo.tuprolog.theory.impl.ListedTheory.retractAll.<anonymous>' call
4323
+ tmp$ret$3 = this.k1l().match(element_0, clause);
4324
+ if (tmp$ret$3) {
4325
+ first.g(element_0);
4326
+ } else {
4327
+ second.g(element_0);
4328
+ }
4329
+ }
4330
+ tmp$ret$4 = new Pair(first, second);
4331
+ var partitionedClauses = tmp$ret$4;
4332
+ var newTheory = partitionedClauses.h4_1;
4333
+ var toBeActuallyRetracted = partitionedClauses.g4_1;
4334
+ tmp = new Success_0(new ListedTheory(this.k1l(), newTheory, this.kt()), toBeActuallyRetracted);
4335
+ }
4336
+ return tmp;
4337
+ };
4338
+ ListedTheory.prototype.retractAll = function (clause) {
4339
+ return this.c1m(clause);
4340
+ };
4341
+ ListedTheory.prototype.hashCode = function () {
4342
+ return _get_hashCodeCache__ny3r0q_1(this);
4343
+ };
4344
+ ListedTheory.prototype.o = function () {
4345
+ return _get_sizeCache__6eswog_0(this);
4346
+ };
4347
+ ListedTheory.prototype.o12 = function (tags) {
4348
+ return tags === this.kt() ? this : new ListedTheory(this.k1l(), this.t1l(), tags);
4349
+ };
4350
+ ListedTheory.prototype.resetTags = function (tags) {
4351
+ return this.o12(tags);
4352
+ };
4353
+ ListedTheory.prototype.n1s = function (theory) {
4354
+ return this.o1l() ? theory.toImmutableTheory() : theory.o1l() ? this : AbstractListedTheory.prototype.n1s.call(this, theory);
4355
+ };
4356
+ ListedTheory.prototype.plusTheory = function (theory) {
4357
+ return this.n1s(theory);
4358
+ };
4359
+ function hashCodeCache$factory_1() {
4360
+ return getPropertyCallableRef('hashCodeCache', 1, KProperty1, function (receiver) {
4361
+ return _get_hashCodeCache__ny3r0q_1(receiver);
4362
+ }, null);
4363
+ }
4364
+ function sizeCache$factory_0() {
4365
+ return getPropertyCallableRef('sizeCache', 1, KProperty1, function (receiver) {
4366
+ return _get_sizeCache__6eswog_0(receiver);
4367
+ }, null);
4368
+ }
4369
+ function MutableIndexedTheory_init_$Init$(unificator, clauses, tags, $this) {
4370
+ MutableIndexedTheory.call($this, Companion_getInstance_8().ofIterable(unificator, clauses), tags);
4371
+ TheoryUtils_getInstance().r1m(clauses);
4372
+ return $this;
4373
+ }
4374
+ function MutableIndexedTheory_init_$Init$_0(unificator, clauses, tags, $mask0, $marker, $this) {
4375
+ if (!(($mask0 & 4) === 0))
4376
+ tags = emptyMap();
4377
+ MutableIndexedTheory_init_$Init$(unificator, clauses, tags, $this);
4378
+ return $this;
4379
+ }
4380
+ function MutableIndexedTheory_init_$Create$(unificator, clauses, tags, $mask0, $marker) {
4381
+ return MutableIndexedTheory_init_$Init$_0(unificator, clauses, tags, $mask0, $marker, Object.create(MutableIndexedTheory.prototype));
4382
+ }
4383
+ function MutableIndexedTheory_init_$Init$_1(unificator, clauses, tags, $this) {
4384
+ MutableIndexedTheory_init_$Init$(unificator, asIterable(clauses), tags, $this);
4385
+ return $this;
4386
+ }
4387
+ function MutableIndexedTheory_init_$Create$_0(unificator, clauses, tags) {
4388
+ return MutableIndexedTheory_init_$Init$_1(unificator, clauses, tags, Object.create(MutableIndexedTheory.prototype));
4389
+ }
4390
+ function toRetractResult(_this__u8e3s4, $this) {
4391
+ return _this__u8e3s4.q12() ? new Success_0($this, ensureNotNull(_this__u8e3s4.t1l())) : new Failure_0($this);
4392
+ }
4393
+ function MutableIndexedTheory$retract$lambda(this$0) {
4394
+ return function (it) {
4395
+ return this$0.d1u_1.z1l(it);
4396
+ };
4397
+ }
4398
+ function MutableIndexedTheory$retract$lambda_0(it) {
4399
+ return it.q12();
4400
+ }
4401
+ function MutableIndexedTheory$retract$lambda_1(it) {
4402
+ return asSequence(ensureNotNull(it.t1l()));
4403
+ }
4404
+ function MutableIndexedTheory(queue, tags) {
4405
+ AbstractIndexedTheory.call(this, queue, tags);
4406
+ this.d1u_1 = queue;
4407
+ }
4408
+ MutableIndexedTheory.prototype.n1t = function () {
4409
+ return this.d1u_1;
4410
+ };
4411
+ MutableIndexedTheory.prototype.l1s = function (unificator) {
4412
+ return AbstractIndexedTheory.prototype.l1s.call(this, unificator).toMutableTheory();
4413
+ };
4414
+ MutableIndexedTheory.prototype.setUnificator = function (unificator) {
4415
+ return this.l1s(unificator);
4416
+ };
4417
+ MutableIndexedTheory.prototype.b1t = function () {
4418
+ return toMutableTheory.call(this);
4419
+ };
4420
+ MutableIndexedTheory.prototype.toMutableTheory = function () {
4421
+ return this.b1t();
4422
+ };
4423
+ MutableIndexedTheory.prototype.t1l = function () {
4424
+ return toList_0(this.d1u_1);
4425
+ };
4426
+ MutableIndexedTheory.prototype.j = function () {
4427
+ return this.d1u_1.j();
4428
+ };
4429
+ MutableIndexedTheory.prototype.w1s = function (clauses, tags, unificator) {
4430
+ return MutableIndexedTheory_init_$Create$_0(unificator, clauses, tags);
4431
+ };
4432
+ MutableIndexedTheory.prototype.e1t = function (clause) {
4433
+ return toRetractResult(this.d1u_1.z1l(clause), this);
4434
+ };
4435
+ MutableIndexedTheory.prototype.retract = function (clause) {
4436
+ return this.e1t(clause);
4437
+ };
4438
+ MutableIndexedTheory.prototype.y1s = function (clauses) {
4439
+ var tmp = asSequence(clauses);
4440
+ var tmp_0 = map(tmp, MutableIndexedTheory$retract$lambda(this));
4441
+ var tmp_1 = filter(tmp_0, MutableIndexedTheory$retract$lambda_0);
4442
+ var retracted = toList(flatMap(tmp_1, MutableIndexedTheory$retract$lambda_1));
4443
+ return retracted.d() ? new Failure_0(this) : new Success_0(this, retracted);
4444
+ };
4445
+ MutableIndexedTheory.prototype.retractIterable = function (clauses) {
4446
+ return this.y1s(clauses);
4447
+ };
4448
+ MutableIndexedTheory.prototype.c1m = function (clause) {
4449
+ return toRetractResult(this.d1u_1.b1m(clause), this);
4450
+ };
4451
+ MutableIndexedTheory.prototype.retractAll = function (clause) {
4452
+ return this.c1m(clause);
4453
+ };
4454
+ MutableIndexedTheory.prototype.b1s = function (clause) {
4455
+ return this.t1s(TheoryUtils_getInstance().g1m(clause));
4456
+ };
4457
+ MutableIndexedTheory.prototype.plus = function (clause) {
4458
+ return this.b1s(clause);
4459
+ };
4460
+ MutableIndexedTheory.prototype.n1s = function (theory) {
4461
+ var tmp;
4462
+ if (theory === this) {
4463
+ tmp = this.u1s(toList_0(theory));
4464
+ } else {
4465
+ tmp = this.u1s(theory);
4466
+ }
4467
+ return tmp;
4468
+ };
4469
+ MutableIndexedTheory.prototype.plusTheory = function (theory) {
4470
+ return this.n1s(theory);
4471
+ };
4472
+ MutableIndexedTheory.prototype.p1s = function (clause) {
4473
+ var tmp$ret$0;
4474
+ // Inline function 'kotlin.also' call
4475
+ // Inline function 'kotlin.contracts.contract' call
4476
+ // Inline function 'it.unibo.tuprolog.theory.impl.MutableIndexedTheory.assertA.<anonymous>' call
4477
+ this.d1u_1.h1m(TheoryUtils_getInstance().g1m(clause));
4478
+ tmp$ret$0 = this;
4479
+ return tmp$ret$0;
4480
+ };
4481
+ MutableIndexedTheory.prototype.assertA = function (clause) {
4482
+ return this.p1s(clause);
4483
+ };
4484
+ MutableIndexedTheory.prototype.r1s = function (clauses) {
4485
+ var tmp$ret$0;
4486
+ // Inline function 'kotlin.also' call
4487
+ // Inline function 'kotlin.contracts.contract' call
4488
+ // Inline function 'it.unibo.tuprolog.theory.impl.MutableIndexedTheory.assertA.<anonymous>' call
4489
+ var tmp0_iterator = asReversed(toList_0(TheoryUtils_getInstance().r1m(clauses))).j();
4490
+ while (tmp0_iterator.m()) {
4491
+ var clause = tmp0_iterator.p();
4492
+ this.d1u_1.h1m(clause);
4493
+ }
4494
+ tmp$ret$0 = this;
4495
+ return tmp$ret$0;
4496
+ };
4497
+ MutableIndexedTheory.prototype.assertAIterable = function (clauses) {
4498
+ return this.r1s(clauses);
4499
+ };
4500
+ MutableIndexedTheory.prototype.s1s = function (clauses) {
4501
+ return this.r1s(asIterable(clauses));
4502
+ };
4503
+ MutableIndexedTheory.prototype.assertASequence = function (clauses) {
4504
+ return this.s1s(clauses);
4505
+ };
4506
+ MutableIndexedTheory.prototype.t1s = function (clause) {
4507
+ var tmp$ret$0;
4508
+ // Inline function 'kotlin.also' call
4509
+ // Inline function 'kotlin.contracts.contract' call
4510
+ // Inline function 'it.unibo.tuprolog.theory.impl.MutableIndexedTheory.assertZ.<anonymous>' call
4511
+ this.d1u_1.i1m(TheoryUtils_getInstance().g1m(clause));
4512
+ tmp$ret$0 = this;
4513
+ return tmp$ret$0;
4514
+ };
4515
+ MutableIndexedTheory.prototype.assertZ = function (clause) {
4516
+ return this.t1s(clause);
4517
+ };
4518
+ MutableIndexedTheory.prototype.u1s = function (clauses) {
4519
+ var tmp$ret$0;
4520
+ // Inline function 'kotlin.also' call
4521
+ // Inline function 'kotlin.contracts.contract' call
4522
+ // Inline function 'it.unibo.tuprolog.theory.impl.MutableIndexedTheory.assertZ.<anonymous>' call
4523
+ this.d1u_1.y1l(TheoryUtils_getInstance().r1m(clauses));
4524
+ tmp$ret$0 = this;
4525
+ return tmp$ret$0;
4526
+ };
4527
+ MutableIndexedTheory.prototype.assertZIterable = function (clauses) {
4528
+ return this.u1s(clauses);
4529
+ };
4530
+ MutableIndexedTheory.prototype.v1s = function (clauses) {
4531
+ return this.u1s(TheoryUtils_getInstance().r1m(asIterable(clauses)));
4532
+ };
4533
+ MutableIndexedTheory.prototype.assertZSequence = function (clauses) {
4534
+ return this.v1s(clauses);
4535
+ };
4536
+ MutableIndexedTheory.prototype.x1s = function (clauses) {
4537
+ return this.y1s(asIterable(clauses));
4538
+ };
4539
+ MutableIndexedTheory.prototype.retractSequence = function (clauses) {
4540
+ return this.x1s(clauses);
4541
+ };
4542
+ MutableIndexedTheory.prototype.g1s = function (indicator) {
4543
+ return AbstractIndexedTheory.prototype.g1s.call(this, indicator).toMutableTheory();
4544
+ };
4545
+ MutableIndexedTheory.prototype.abolish = function (indicator) {
4546
+ return this.g1s(indicator);
4547
+ };
4548
+ MutableIndexedTheory.prototype.a1s = function () {
4549
+ return Companion_getInstance_13().indexedOfIterable(this.k1l(), this);
4550
+ };
4551
+ MutableIndexedTheory.prototype.toImmutableTheory = function () {
4552
+ return this.a1s();
4553
+ };
4554
+ MutableIndexedTheory.prototype.o12 = function (tags) {
4555
+ return tags === this.kt() ? this : new MutableIndexedTheory(this.d1u_1, tags);
4556
+ };
4557
+ MutableIndexedTheory.prototype.resetTags = function (tags) {
4558
+ return this.o12(tags);
4559
+ };
4560
+ MutableIndexedTheory.prototype.z1s = function () {
4561
+ var tmp = asSequence(this.t1l());
4562
+ return this.m1s(tmp, null, null, 6, null);
4563
+ };
4564
+ MutableIndexedTheory.prototype.clone = function () {
4565
+ return this.z1s();
4566
+ };
4567
+ MutableIndexedTheory.prototype.assertAFact = function (struct) {
4568
+ return this.c1t(struct);
4569
+ };
4570
+ MutableIndexedTheory.prototype.assertZFact = function (struct) {
4571
+ return this.d1t(struct);
4572
+ };
4573
+ MutableIndexedTheory.prototype.retractByHead = function (head) {
4574
+ return this.f1t(head);
4575
+ };
4576
+ MutableIndexedTheory.prototype.retractAllByHead = function (head) {
4577
+ return this.g1t(head);
4578
+ };
4579
+ function MutableListedTheory_init_$Init$(unificator, clauses, tags, $this) {
4580
+ MutableListedTheory.call($this, unificator, toMutableList(clauses), tags);
4581
+ TheoryUtils_getInstance().r1m(clauses);
4582
+ return $this;
4583
+ }
4584
+ function MutableListedTheory_init_$Init$_0(unificator, clauses, tags, $mask0, $marker, $this) {
4585
+ if (!(($mask0 & 4) === 0))
4586
+ tags = emptyMap();
4587
+ MutableListedTheory_init_$Init$(unificator, clauses, tags, $this);
4588
+ return $this;
4589
+ }
4590
+ function MutableListedTheory_init_$Create$(unificator, clauses, tags, $mask0, $marker) {
4591
+ return MutableListedTheory_init_$Init$_0(unificator, clauses, tags, $mask0, $marker, Object.create(MutableListedTheory.prototype));
4592
+ }
4593
+ function MutableListedTheory_init_$Init$_1(unificator, clauses, tags, $this) {
4594
+ MutableListedTheory.call($this, unificator, toMutableList_0(clauses), tags);
4595
+ TheoryUtils_getInstance().o1s(clauses);
4596
+ return $this;
4597
+ }
4598
+ function MutableListedTheory_init_$Create$_0(unificator, clauses, tags) {
4599
+ return MutableListedTheory_init_$Init$_1(unificator, clauses, tags, Object.create(MutableListedTheory.prototype));
4600
+ }
4601
+ function MutableListedTheory(unificator, clauses, tags) {
4602
+ AbstractListedTheory.call(this, unificator, clauses, tags);
4603
+ this.h1u_1 = clauses;
4604
+ }
4605
+ MutableListedTheory.prototype.t1l = function () {
4606
+ return this.h1u_1;
4607
+ };
4608
+ MutableListedTheory.prototype.l1s = function (unificator) {
4609
+ this.r1t(unificator);
4610
+ return this;
4611
+ };
4612
+ MutableListedTheory.prototype.setUnificator = function (unificator) {
4613
+ return this.l1s(unificator);
4614
+ };
4615
+ MutableListedTheory.prototype.b1t = function () {
4616
+ return toMutableTheory.call(this);
4617
+ };
4618
+ MutableListedTheory.prototype.toMutableTheory = function () {
4619
+ return this.b1t();
4620
+ };
4621
+ MutableListedTheory.prototype.w1s = function (clauses, tags, unificator) {
4622
+ return MutableListedTheory_init_$Create$_0(unificator, clauses, tags);
4623
+ };
4624
+ MutableListedTheory.prototype.e1t = function (clause) {
4625
+ var i = this.h1u_1.bb();
4626
+ while (i.m()) {
4627
+ var c = i.p();
4628
+ if (this.k1l().match(c, clause)) {
4629
+ i.u4();
4630
+ return new Success_0(this, listOf_0(c));
4631
+ }
4632
+ }
4633
+ return new Failure_0(this);
4634
+ };
4635
+ MutableListedTheory.prototype.retract = function (clause) {
4636
+ return this.e1t(clause);
4637
+ };
4638
+ MutableListedTheory.prototype.y1s = function (clauses) {
4639
+ var i = this.h1u_1.bb();
4640
+ var tmp$ret$0;
4641
+ // Inline function 'kotlin.collections.mutableListOf' call
4642
+ tmp$ret$0 = ArrayList_init_$Create$_0();
4643
+ var retracted = tmp$ret$0;
4644
+ while (i.m()) {
4645
+ var c = i.p();
4646
+ var tmp0_iterator = clauses.j();
4647
+ while (tmp0_iterator.m()) {
4648
+ var clause = tmp0_iterator.p();
4649
+ if (this.k1l().match(c, clause)) {
4650
+ retracted.g(c);
4651
+ i.u4();
4652
+ }
4653
+ }
4654
+ }
4655
+ var tmp;
4656
+ if (retracted.d()) {
4657
+ tmp = new Failure_0(this);
4658
+ } else {
4659
+ tmp = new Success_0(this, retracted);
4660
+ }
4661
+ return tmp;
4662
+ };
4663
+ MutableListedTheory.prototype.retractIterable = function (clauses) {
4664
+ return this.y1s(clauses);
4665
+ };
4666
+ MutableListedTheory.prototype.c1m = function (clause) {
4667
+ var i = this.h1u_1.bb();
4668
+ var tmp$ret$0;
4669
+ // Inline function 'kotlin.collections.mutableListOf' call
4670
+ tmp$ret$0 = ArrayList_init_$Create$_0();
4671
+ var retracted = tmp$ret$0;
4672
+ while (i.m()) {
4673
+ var c = i.p();
4674
+ if (this.k1l().match(c, clause)) {
4675
+ retracted.g(c);
4676
+ i.u4();
4677
+ }
4678
+ }
4679
+ var tmp;
4680
+ if (retracted.d()) {
4681
+ tmp = new Failure_0(this);
4682
+ } else {
4683
+ tmp = new Success_0(this, retracted);
4684
+ }
4685
+ return tmp;
4686
+ };
4687
+ MutableListedTheory.prototype.retractAll = function (clause) {
4688
+ return this.c1m(clause);
4689
+ };
4690
+ MutableListedTheory.prototype.b1s = function (clause) {
4691
+ return this.t1s(clause);
4692
+ };
4693
+ MutableListedTheory.prototype.plus = function (clause) {
4694
+ return this.b1s(clause);
4695
+ };
4696
+ MutableListedTheory.prototype.n1s = function (theory) {
4697
+ var tmp;
4698
+ if (theory === this) {
4699
+ tmp = this.u1s(toList_0(theory));
4700
+ } else {
4701
+ tmp = this.u1s(theory);
4702
+ }
4703
+ return tmp;
4704
+ };
4705
+ MutableListedTheory.prototype.plusTheory = function (theory) {
4706
+ return this.n1s(theory);
4707
+ };
4708
+ MutableListedTheory.prototype.p1s = function (clause) {
4709
+ var tmp$ret$0;
4710
+ // Inline function 'kotlin.also' call
4711
+ // Inline function 'kotlin.contracts.contract' call
4712
+ // Inline function 'it.unibo.tuprolog.theory.impl.MutableListedTheory.assertA.<anonymous>' call
4713
+ addFirst(this.h1u_1, TheoryUtils_getInstance().g1m(clause));
4714
+ tmp$ret$0 = this;
4715
+ return tmp$ret$0;
4716
+ };
4717
+ MutableListedTheory.prototype.assertA = function (clause) {
4718
+ return this.p1s(clause);
4719
+ };
4720
+ MutableListedTheory.prototype.r1s = function (clauses) {
4721
+ var tmp$ret$0;
4722
+ // Inline function 'kotlin.also' call
4723
+ // Inline function 'kotlin.contracts.contract' call
4724
+ // Inline function 'it.unibo.tuprolog.theory.impl.MutableListedTheory.assertA.<anonymous>' call
4725
+ addFirst_0(this.h1u_1, TheoryUtils_getInstance().r1m(clauses));
4726
+ tmp$ret$0 = this;
4727
+ return tmp$ret$0;
4728
+ };
4729
+ MutableListedTheory.prototype.assertAIterable = function (clauses) {
4730
+ return this.r1s(clauses);
4731
+ };
4732
+ MutableListedTheory.prototype.s1s = function (clauses) {
4733
+ return this.r1s(asIterable(clauses));
4734
+ };
4735
+ MutableListedTheory.prototype.assertASequence = function (clauses) {
4736
+ return this.s1s(clauses);
4737
+ };
4738
+ MutableListedTheory.prototype.t1s = function (clause) {
4739
+ var tmp$ret$0;
4740
+ // Inline function 'kotlin.also' call
4741
+ // Inline function 'kotlin.contracts.contract' call
4742
+ // Inline function 'it.unibo.tuprolog.theory.impl.MutableListedTheory.assertZ.<anonymous>' call
4743
+ this.h1u_1.g(TheoryUtils_getInstance().g1m(clause));
4744
+ tmp$ret$0 = this;
4745
+ return tmp$ret$0;
4746
+ };
4747
+ MutableListedTheory.prototype.assertZ = function (clause) {
4748
+ return this.t1s(clause);
4749
+ };
4750
+ MutableListedTheory.prototype.u1s = function (clauses) {
4751
+ var tmp$ret$0;
4752
+ // Inline function 'kotlin.also' call
4753
+ // Inline function 'kotlin.contracts.contract' call
4754
+ // Inline function 'it.unibo.tuprolog.theory.impl.MutableListedTheory.assertZ.<anonymous>' call
4755
+ addAll(this.h1u_1, TheoryUtils_getInstance().r1m(clauses));
4756
+ tmp$ret$0 = this;
4757
+ return tmp$ret$0;
4758
+ };
4759
+ MutableListedTheory.prototype.assertZIterable = function (clauses) {
4760
+ return this.u1s(clauses);
4761
+ };
4762
+ MutableListedTheory.prototype.v1s = function (clauses) {
4763
+ return this.u1s(asIterable(clauses));
4764
+ };
4765
+ MutableListedTheory.prototype.assertZSequence = function (clauses) {
4766
+ return this.v1s(clauses);
4767
+ };
4768
+ MutableListedTheory.prototype.x1s = function (clauses) {
4769
+ return this.y1s(asIterable(clauses));
4770
+ };
4771
+ MutableListedTheory.prototype.retractSequence = function (clauses) {
4772
+ return this.x1s(clauses);
4773
+ };
4774
+ MutableListedTheory.prototype.g1s = function (indicator) {
4775
+ return AbstractListedTheory.prototype.g1s.call(this, indicator).toMutableTheory();
4776
+ };
4777
+ MutableListedTheory.prototype.abolish = function (indicator) {
4778
+ return this.g1s(indicator);
4779
+ };
4780
+ MutableListedTheory.prototype.a1s = function () {
4781
+ return Companion_getInstance_13().listedOfIterable(this.k1l(), this);
4782
+ };
4783
+ MutableListedTheory.prototype.toImmutableTheory = function () {
4784
+ return this.a1s();
4785
+ };
4786
+ MutableListedTheory.prototype.o12 = function (tags) {
4787
+ return tags === this.kt() ? this : new MutableListedTheory(this.k1l(), this.h1u_1, tags);
4788
+ };
4789
+ MutableListedTheory.prototype.resetTags = function (tags) {
4790
+ return this.o12(tags);
4791
+ };
4792
+ MutableListedTheory.prototype.z1s = function () {
4793
+ var tmp = asSequence(this.h1u_1);
4794
+ return this.m1s(tmp, null, null, 6, null);
4795
+ };
4796
+ MutableListedTheory.prototype.clone = function () {
4797
+ return this.z1s();
4798
+ };
4799
+ MutableListedTheory.prototype.assertAFact = function (struct) {
4800
+ return this.c1t(struct);
4801
+ };
4802
+ MutableListedTheory.prototype.assertZFact = function (struct) {
4803
+ return this.d1t(struct);
4804
+ };
4805
+ MutableListedTheory.prototype.retractByHead = function (head) {
4806
+ return this.f1t(head);
4807
+ };
4808
+ MutableListedTheory.prototype.retractAllByHead = function (head) {
4809
+ return this.g1t(head);
4810
+ };
4811
+ function takeFirstAfterSkipping(_this__u8e3s4, n) {
4812
+ var iter = _this__u8e3s4.j();
4813
+ var inductionVariable = 0;
4814
+ if (inductionVariable < n)
4815
+ do {
4816
+ var i = inductionVariable;
4817
+ inductionVariable = inductionVariable + 1 | 0;
4818
+ iter.p();
4819
+ }
4820
+ while (inductionVariable < n);
4821
+ return iter.p();
4822
+ }
4823
+ //region block: post-declaration
4824
+ MutableReteClauseQueue.prototype.r1l = get;
4825
+ ReteClauseQueue.prototype.r1l = get;
4826
+ IndexedClause$Companion$wrap$1.prototype.p1n = get_innerClause;
4827
+ IndexedClause$Companion$wrap$1.prototype.w1o = plus_1;
4828
+ IndexedClause$Companion$wrap$1.prototype.zs = compareTo;
4829
+ SituatedIndexedClause$Companion$of$1.prototype.p1n = get_innerClause;
4830
+ SituatedIndexedClause$Companion$of$1.prototype.w1o = plus_1;
4831
+ SituatedIndexedClause$Companion$of$1.prototype.zs = compareTo;
4832
+ AbstractTheory.prototype.a1t = get_isMutable;
4833
+ AbstractTheory.prototype.n1l = get_rules;
4834
+ AbstractTheory.prototype.m1l = get_directives;
4835
+ AbstractTheory.prototype.assertAFact = assertAFact;
4836
+ AbstractTheory.prototype.assertZFact = assertZFact;
4837
+ AbstractTheory.prototype.retractByHead = retractByHead;
4838
+ AbstractTheory.prototype.retractAllByHead = retractAllByHead;
4839
+ AbstractTheory.prototype.getTag = getTag;
4840
+ AbstractTheory.prototype.containsTag = containsTag;
4841
+ AbstractIndexedTheory.prototype.assertAFact = assertAFact;
4842
+ AbstractIndexedTheory.prototype.assertZFact = assertZFact;
4843
+ AbstractIndexedTheory.prototype.retractByHead = retractByHead;
4844
+ AbstractIndexedTheory.prototype.a1t = get_isMutable;
4845
+ AbstractIndexedTheory.prototype.retractAllByHead = retractAllByHead;
4846
+ AbstractIndexedTheory.prototype.getTag = getTag;
4847
+ AbstractIndexedTheory.prototype.containsTag = containsTag;
4848
+ AbstractListedTheory.prototype.assertAFact = assertAFact;
4849
+ AbstractListedTheory.prototype.assertZFact = assertZFact;
4850
+ AbstractListedTheory.prototype.retractByHead = retractByHead;
4851
+ AbstractListedTheory.prototype.a1t = get_isMutable;
4852
+ AbstractListedTheory.prototype.n1l = get_rules;
4853
+ AbstractListedTheory.prototype.m1l = get_directives;
4854
+ AbstractListedTheory.prototype.retractAllByHead = retractAllByHead;
4855
+ AbstractListedTheory.prototype.getTag = getTag;
4856
+ AbstractListedTheory.prototype.containsTag = containsTag;
4857
+ IndexedTheory.prototype.assertAFact = assertAFact;
4858
+ IndexedTheory.prototype.assertZFact = assertZFact;
4859
+ IndexedTheory.prototype.retractByHead = retractByHead;
4860
+ IndexedTheory.prototype.a1t = get_isMutable;
4861
+ IndexedTheory.prototype.retractAllByHead = retractAllByHead;
4862
+ IndexedTheory.prototype.getTag = getTag;
4863
+ IndexedTheory.prototype.containsTag = containsTag;
4864
+ ListedTheory.prototype.assertAFact = assertAFact;
4865
+ ListedTheory.prototype.assertZFact = assertZFact;
4866
+ ListedTheory.prototype.retractByHead = retractByHead;
4867
+ ListedTheory.prototype.a1t = get_isMutable;
4868
+ ListedTheory.prototype.n1l = get_rules;
4869
+ ListedTheory.prototype.m1l = get_directives;
4870
+ ListedTheory.prototype.retractAllByHead = retractAllByHead;
4871
+ ListedTheory.prototype.getTag = getTag;
4872
+ ListedTheory.prototype.containsTag = containsTag;
4873
+ MutableIndexedTheory.prototype.c1t = assertAFact_0;
4874
+ MutableIndexedTheory.prototype.d1t = assertZFact_0;
4875
+ MutableIndexedTheory.prototype.f1t = retractByHead_0;
4876
+ MutableIndexedTheory.prototype.a1t = get_isMutable_0;
4877
+ MutableIndexedTheory.prototype.g1t = retractAllByHead_0;
4878
+ MutableIndexedTheory.prototype.getTag = getTag;
4879
+ MutableIndexedTheory.prototype.containsTag = containsTag;
4880
+ MutableListedTheory.prototype.c1t = assertAFact_0;
4881
+ MutableListedTheory.prototype.d1t = assertZFact_0;
4882
+ MutableListedTheory.prototype.f1t = retractByHead_0;
4883
+ MutableListedTheory.prototype.a1t = get_isMutable_0;
4884
+ MutableListedTheory.prototype.n1l = get_rules;
4885
+ MutableListedTheory.prototype.m1l = get_directives;
4886
+ MutableListedTheory.prototype.g1t = retractAllByHead_0;
4887
+ MutableListedTheory.prototype.getTag = getTag;
4888
+ MutableListedTheory.prototype.containsTag = containsTag;
4889
+ //endregion
4890
+ //region block: exports
4891
+ _.$_$ = _.$_$ || {};
4892
+ _.$_$.a = Companion_getInstance_12;
4893
+ _.$_$.b = Companion_getInstance_13;
4894
+ _.$_$.c = MutableTheory;
4895
+ _.$_$.d = Failure_0;
4896
+ _.$_$.e = Success_0;
4897
+ _.$_$.f = Theory;
4898
+ //endregion
4899
+ return _;
4900
+ }(module.exports, require('./kotlin-kotlin-stdlib-js-ir.js'), require('./2p-core.js'), require('./2p-utils.js'), require('./2p-unify.js')));
4901
+
4902
+ //# sourceMappingURL=2p-theory.js.map