16
16
17
17
package org.modelix.model.api
18
18
19
- import kotlin.reflect.KProperty
20
-
21
19
/* *
22
20
* TODO if you add a new Concept to a language, do not forget to add it to the language's included concepts field.
23
21
* Otherwise the concept will not be eagerly added to the Language, when registering the language in the ILanguageRegistry.
@@ -38,9 +36,18 @@ object BuiltinLanguages {
38
36
addConcept(this )
39
37
}
40
38
41
- val virtualPackage by property(" ceab5195-25ea-4f22-9b92-103b95ca8c0c/1133920641626/1193676396447" )
42
- val smodelAttribute by childLink(" ceab5195-25ea-4f22-9b92-103b95ca8c0c/1133920641626/5169995583184591170" ).multiple()
43
- .optional().type { Attribute }
39
+ val virtualPackage = SimpleProperty (
40
+ " virtualPackage" ,
41
+ uid = " ceab5195-25ea-4f22-9b92-103b95ca8c0c/1133920641626/1193676396447" ,
42
+ ).also (this ::addProperty)
43
+
44
+ val smodelAttribute = SimpleChildLink (
45
+ simpleName = " smodelAttribute" ,
46
+ isMultiple = true ,
47
+ isOptional = true ,
48
+ targetConcept = Attribute ,
49
+ uid = " ceab5195-25ea-4f22-9b92-103b95ca8c0c/1133920641626/5169995583184591170" ,
50
+ ).also (this ::addChildLink)
44
51
}
45
52
46
53
object Attribute : SimpleConcept(
@@ -63,7 +70,10 @@ object BuiltinLanguages {
63
70
64
71
object INamedConcept : SimpleConcept(conceptName = " INamedConcept" ) {
65
72
init { addConcept(this ) }
66
- val name by property(" ceab5195-25ea-4f22-9b92-103b95ca8c0c/1169194658468/1169194664001" )
73
+ val name = SimpleProperty (
74
+ " name" ,
75
+ uid = " ceab5195-25ea-4f22-9b92-103b95ca8c0c/1169194658468/1169194664001" ,
76
+ ).also (this ::addProperty)
67
77
}
68
78
}
69
79
@@ -88,30 +98,39 @@ object BuiltinLanguages {
88
98
) {
89
99
init { addConcept(this ) }
90
100
91
- val id by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618892/2615330535972958738" )
92
- val stereotype by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618892/3832696962605996173" )
101
+ val id = SimpleProperty (
102
+ " id" ,
103
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618892/2615330535972958738" ,
104
+ ).also (this ::addProperty)
105
+
106
+ val stereotype = SimpleProperty (
107
+ " stereotype" ,
108
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618892/3832696962605996173" ,
109
+ ).also (this ::addProperty)
93
110
94
111
val rootNodes = SimpleChildLink (
95
112
simpleName = " rootNodes" ,
96
113
isMultiple = true ,
97
114
isOptional = true ,
98
115
targetConcept = jetbrains_mps_lang_core.BaseConcept ,
99
116
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618892/474657388638618900" ,
100
- )
117
+ ).also (this ::addChildLink)
118
+
101
119
val modelImports = SimpleChildLink (
102
120
simpleName = " modelImports" ,
103
121
isMultiple = true ,
104
122
isOptional = true ,
105
123
targetConcept = ModelReference ,
106
124
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618892/6402965165736931000" ,
107
- )
125
+ ).also (this ::addChildLink)
126
+
108
127
val usedLanguages = SimpleChildLink (
109
128
simpleName = " usedLanguages" ,
110
129
isMultiple = true ,
111
130
isOptional = true ,
112
131
targetConcept = SingleLanguageDependency ,
113
132
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618892/5381564949800872334" ,
114
- )
133
+ ). also ( this ::addChildLink)
115
134
}
116
135
117
136
object Module : SimpleConcept(
@@ -121,38 +140,52 @@ object BuiltinLanguages {
121
140
) {
122
141
init { addConcept(this ) }
123
142
124
- val id by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/4225291329823310560" )
125
- val moduleVersion by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/2206727074858242370" )
126
- val compileInMPS by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/2206727074858242373" )
143
+ val id = SimpleProperty (
144
+ " id" ,
145
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/4225291329823310560" ,
146
+ ).also (this ::addProperty)
147
+
148
+ val moduleVersion = SimpleProperty (
149
+ " moduleVersion" ,
150
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/2206727074858242370" ,
151
+ ).also (this ::addProperty)
152
+
153
+ val compileInMPS = SimpleProperty (
154
+ " compileInMPS" ,
155
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/2206727074858242373" ,
156
+ ).also (this ::addProperty)
127
157
128
158
val models = SimpleChildLink (
129
159
simpleName = " models" ,
130
160
isMultiple = true ,
131
161
isOptional = true ,
132
162
targetConcept = Model ,
133
163
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/474657388638618898" ,
134
- )
164
+ ).also (this ::addChildLink)
165
+
135
166
val facets = SimpleChildLink (
136
167
simpleName = " facets" ,
137
168
isMultiple = true ,
138
169
isOptional = true ,
139
170
targetConcept = ModuleFacet ,
140
171
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/2206727074858242412" ,
141
- )
172
+ ).also (this ::addChildLink)
173
+
142
174
val dependencies = SimpleChildLink (
143
175
simpleName = " dependencies" ,
144
176
isMultiple = true ,
145
177
isOptional = true ,
146
178
targetConcept = ModuleDependency ,
147
179
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/2206727074858242425" ,
148
- )
180
+ ).also (this ::addChildLink)
181
+
149
182
val languageDependencies = SimpleChildLink (
150
183
simpleName = " languageDependencies" ,
151
184
isMultiple = true ,
152
185
isOptional = true ,
153
186
targetConcept = LanguageDependency ,
154
187
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618895/2206727074858242439" ,
155
- )
188
+ ). also ( this ::addChildLink)
156
189
}
157
190
158
191
object Solution : SimpleConcept(
@@ -192,23 +225,23 @@ object BuiltinLanguages {
192
225
isOptional = true ,
193
226
targetConcept = Module ,
194
227
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618902/474657388638618903" ,
195
- )
228
+ ). also ( this ::addChildLink)
196
229
197
230
val projects = SimpleChildLink (
198
231
simpleName = " projects" ,
199
232
isMultiple = true ,
200
233
isOptional = true ,
201
234
targetConcept = Project ,
202
235
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618902/7064605579395546636" ,
203
- )
236
+ ). also ( this ::addChildLink)
204
237
205
238
val tempModules = SimpleChildLink (
206
239
simpleName = " tempModules" ,
207
240
isMultiple = true ,
208
241
isOptional = true ,
209
242
targetConcept = Module ,
210
243
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/474657388638618902/8226136427470548682" ,
211
- )
244
+ ). also ( this ::addChildLink)
212
245
}
213
246
214
247
object Project : SimpleConcept(
@@ -224,15 +257,15 @@ object BuiltinLanguages {
224
257
isOptional = true ,
225
258
targetConcept = Module ,
226
259
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/4008363636171860313/4008363636171860450" ,
227
- )
260
+ ). also ( this ::addChildLink)
228
261
229
262
val projectModules = SimpleChildLink (
230
263
simpleName = " projectModules" ,
231
264
isMultiple = true ,
232
265
isOptional = true ,
233
266
targetConcept = ProjectModule ,
234
267
uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/4008363636171860313/4201834143491306088" ,
235
- )
268
+ ). also ( this ::addChildLink)
236
269
}
237
270
238
271
object ProjectModule : SimpleConcept(
@@ -242,7 +275,10 @@ object BuiltinLanguages {
242
275
) {
243
276
init { addConcept(this ) }
244
277
245
- val virtualFolder by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/4201834143491306084/4201834143491306085" )
278
+ val virtualFolder = SimpleProperty (
279
+ " virtualFolder" ,
280
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/4201834143491306084/4201834143491306085" ,
281
+ ).also (this ::addProperty)
246
282
}
247
283
248
284
object ModuleReference : SimpleConcept(
@@ -283,8 +319,15 @@ object BuiltinLanguages {
283
319
) {
284
320
init { addConcept(this ) }
285
321
286
- val uuid by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/8958347146611575311/8958347146611575314" )
287
- val name by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/8958347146611575311/8958347146611575315" )
322
+ val uuid = SimpleProperty (
323
+ " uuid" ,
324
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/8958347146611575311/8958347146611575314" ,
325
+ ).also (this ::addProperty)
326
+
327
+ val name = SimpleProperty (
328
+ " name" ,
329
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/8958347146611575311/8958347146611575315" ,
330
+ ).also (this ::addProperty)
288
331
}
289
332
290
333
object SingleLanguageDependency : SimpleConcept(
@@ -294,7 +337,10 @@ object BuiltinLanguages {
294
337
) {
295
338
init { addConcept(this ) }
296
339
297
- val version by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242429/2206727074858242435" )
340
+ val version = SimpleProperty (
341
+ " version" ,
342
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242429/2206727074858242435" ,
343
+ ).also (this ::addProperty)
298
344
}
299
345
300
346
object DevkitDependency : SimpleConcept(
@@ -320,8 +366,15 @@ object BuiltinLanguages {
320
366
) {
321
367
init { addConcept(this ) }
322
368
323
- val generated by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242406/2206727074858242407" )
324
- val path by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242406/2206727074858242409" )
369
+ val generated = SimpleProperty (
370
+ " generated" ,
371
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242406/2206727074858242407" ,
372
+ ).also (this ::addProperty)
373
+
374
+ val path = SimpleProperty (
375
+ " path" ,
376
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242406/2206727074858242409" ,
377
+ ).also (this ::addProperty)
325
378
}
326
379
327
380
object ModuleDependency : SimpleConcept(
@@ -331,12 +384,35 @@ object BuiltinLanguages {
331
384
) {
332
385
init { addConcept(this ) }
333
386
334
- val reexport by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858242416" )
335
- val uuid by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858242418" )
336
- val name by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858242421" )
337
- val explicit by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858750565" )
338
- val version by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858750570" )
339
- val scope by property(" 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/8438396892798826745" )
387
+ val reexport = SimpleProperty (
388
+ " reexport" ,
389
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858242416" ,
390
+ ).also (this ::addProperty)
391
+
392
+ val uuid = SimpleProperty (
393
+ " uuid" ,
394
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858242418" ,
395
+ ).also (this ::addProperty)
396
+
397
+ val name = SimpleProperty (
398
+ " name" ,
399
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858242421" ,
400
+ ).also (this ::addProperty)
401
+
402
+ val explicit = SimpleProperty (
403
+ " explicit" ,
404
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858750565" ,
405
+ ).also (this ::addProperty)
406
+
407
+ val version = SimpleProperty (
408
+ " version" ,
409
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/2206727074858750570" ,
410
+ ).also (this ::addProperty)
411
+
412
+ val scope = SimpleProperty (
413
+ " scope" ,
414
+ uid = " 0a7577d1-d4e5-431d-98b1-fae38f9aee80/2206727074858242415/8438396892798826745" ,
415
+ ).also (this ::addProperty)
340
416
}
341
417
}
342
418
@@ -358,7 +434,7 @@ object BuiltinLanguages {
358
434
isOptional = true ,
359
435
targetConcept = RepositoryInfo ,
360
436
uid = " b6980ebd-f01d-459d-a952-38740f6313b4/7113393488488348863/7113393488488348866" ,
361
- )
437
+ ). also ( this ::addChildLink)
362
438
}
363
439
364
440
object RepositoryInfo : SimpleConcept(
@@ -368,15 +444,18 @@ object BuiltinLanguages {
368
444
) {
369
445
init { addConcept(this ) }
370
446
371
- val id by property(" b6980ebd-f01d-459d-a952-38740f6313b4/7113393488488348864/7113393488488348870" )
447
+ val id = SimpleProperty (
448
+ " id" ,
449
+ uid = " b6980ebd-f01d-459d-a952-38740f6313b4/7113393488488348864/7113393488488348870" ,
450
+ ).also (this ::addProperty)
372
451
373
452
val branches = SimpleChildLink (
374
453
simpleName = " branches" ,
375
454
isMultiple = true ,
376
455
isOptional = true ,
377
456
targetConcept = BranchInfo ,
378
457
uid = " b6980ebd-f01d-459d-a952-38740f6313b4/7113393488488348864/7113393488488348868" ,
379
- )
458
+ ). also ( this ::addChildLink)
380
459
}
381
460
382
461
object BranchInfo : SimpleConcept(
@@ -394,46 +473,3 @@ object BuiltinLanguages {
394
473
ModelixRuntimelang ,
395
474
)
396
475
}
397
-
398
- private fun SimpleConcept.property (uid : String ) = object {
399
- private lateinit var name: String
400
- private lateinit var owner: SimpleConcept
401
- private val instance: IProperty by lazy {
402
- SimpleProperty (name, uid = uid).also { owner.addProperty(it) }
403
- }
404
-
405
- operator fun getValue (ownerConcept : SimpleConcept , kotlinProperty : KProperty <* >): IProperty {
406
- this .owner = ownerConcept
407
- this .name = kotlinProperty.name
408
- return instance
409
- }
410
- }
411
-
412
- private fun SimpleConcept.childLink (uid : String ) = object {
413
- private lateinit var name: String
414
- private lateinit var owner: SimpleConcept
415
- private var multiple: Boolean = true
416
- private var optional: Boolean = true
417
- private lateinit var targetConcept: () -> IConcept
418
- private val instance: IChildLink by lazy {
419
- SimpleChildLink (
420
- simpleName = name,
421
- uid = uid,
422
- isMultiple = multiple,
423
- isOptional = optional,
424
- targetConcept = targetConcept(),
425
- ).also { owner.addChildLink(it) }
426
- }
427
-
428
- operator fun getValue (ownerConcept : SimpleConcept , kotlinProperty : KProperty <* >): IChildLink {
429
- this .owner = ownerConcept
430
- this .name = kotlinProperty.name
431
- return instance
432
- }
433
-
434
- fun mandatory () = this .also { this .optional = false }
435
- fun optional () = this .also { this .optional = true }
436
- fun single () = this .also { this .multiple = false }
437
- fun multiple () = this .also { this .multiple = true }
438
- fun type (targetConcept : () -> IConcept ) = also { this .targetConcept = targetConcept }
439
- }
0 commit comments