@tuprolog/arg2p-core 0.7.0 → 0.7.2

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