-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathFeatureExtensions.cs
More file actions
607 lines (571 loc) · 25 KB
/
FeatureExtensions.cs
File metadata and controls
607 lines (571 loc) · 25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
// -------------------------------------------------------------------------------------------------
// <copyright file="FeatureExtensions.cs" company="Starion Group S.A.">
//
// Copyright (C) 2022-2026 Starion Group S.A.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
// ------------------------------------------------------------------------------------------------
namespace SysML2.NET.Core.POCO.Core.Features
{
using System;
using System.Collections.Generic;
using SysML2.NET.Core.Core.Types;
using SysML2.NET.Core.POCO.Core.Types;
using SysML2.NET.Core.POCO.Root.Annotations;
using SysML2.NET.Core.POCO.Root.Elements;
using SysML2.NET.Core.POCO.Root.Namespaces;
/// <summary>
/// The <see cref="FeatureExtensions"/> class provides extensions methods for
/// the <see cref="IFeature"/> interface
/// </summary>
internal static class FeatureExtensions
{
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IFeature> ComputeChainingFeature(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static IFeature ComputeCrossFeature(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static IType ComputeEndOwningType(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static IFeature ComputeFeatureTarget(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IType> ComputeFeaturingType(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static ICrossSubsetting ComputeOwnedCrossSubsetting(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IFeatureChaining> ComputeOwnedFeatureChaining(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IFeatureInverting> ComputeOwnedFeatureInverting(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IRedefinition> ComputeOwnedRedefinition(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static IReferenceSubsetting ComputeOwnedReferenceSubsetting(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<ISubsetting> ComputeOwnedSubsetting(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<ITypeFeaturing> ComputeOwnedTypeFeaturing(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IFeatureTyping> ComputeOwnedTyping(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static IFeatureMembership ComputeOwningFeatureMembership(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static IType ComputeOwningType(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Computes the derived property.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// the computed result
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IType> ComputeType(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Return the directionOf this Feature relative to the given type.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <param name="type">
/// No documentation provided
/// </param>
/// <returns>
/// The expected <see cref="FeatureDirectionKind" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static FeatureDirectionKind? ComputeDirectionForOperation(this IFeature featureSubject, IType type)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// If a Feature has no declaredShortName or declaredName, then its effective shortName is given by the
/// effective shortName of the Feature returned by the namingFeature() operation, if any.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// The expected <see cref="string" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static string ComputeRedefinedEffectiveShortNameOperation(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// If a Feature has no declaredName or declaredShortName , then its
/// effective name is given by the effective name of the Feature returned by the namingFeature()
/// operation, if any.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// The expected <see cref="string" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static string ComputeRedefinedEffectiveNameOperation(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// By default, the naming Feature of a Feature is given by its first redefinedFeature of its first
/// ownedRedefinition, if any.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// The expected <see cref="IFeature" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static IFeature ComputeNamingFeatureOperation(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <param name="excludeImplied">
/// No documentation provided
/// </param>
/// <returns>
/// The expected collection of <see cref="IType" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IType> ComputeRedefinedSupertypesOperation(this IFeature featureSubject, bool excludeImplied)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Check whether this Feature directly redefines the given redefinedFeature.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <param name="redefinedFeature">
/// No documentation provided
/// </param>
/// <returns>
/// The expected <see cref="bool" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static bool ComputeRedefinesOperation(this IFeature featureSubject, IFeature redefinedFeature)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Check whether this Feature directly redefines the named library Feature. libraryFeatureName must
/// conform to the syntax of a KerML qualified name and must resolve to a Feature in global scope.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <param name="libraryFeatureName">
/// No documentation provided
/// </param>
/// <returns>
/// The expected <see cref="bool" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static bool ComputeRedefinesFromLibraryOperation(this IFeature featureSubject, string libraryFeatureName)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Check whether this Feature directly or indirectly specializes a Feature whose last two
/// chainingFeatures are the given Features first and second.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <param name="first">
/// No documentation provided
/// </param>
/// <param name="second">
/// No documentation provided
/// </param>
/// <returns>
/// The expected <see cref="bool" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static bool ComputeSubsetsChainOperation(this IFeature featureSubject, IFeature first, IFeature second)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// A Feature is compatible with an otherType if it either directly or indirectly specializes the
/// otherType or if the otherType is also a Feature and all of the following are true.
/// <ol> <li>Neither this Feature or the otherType have any
/// ownedFeatures.</li> <li>This Feature directly or indirectly redefines a
/// Feature that is also directly or indirectly redefined by the otherType.</li>
/// <li>This Feature can access the otherType. </li></ol>
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <param name="otherType">
/// No documentation provided
/// </param>
/// <returns>
/// The expected <see cref="bool" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static bool ComputeRedefinedIsCompatibleWithOperation(this IFeature featureSubject, IType otherType)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Return the Features used to determine the types of this Feature (other than this Feature itself). If
/// this Feature is not conjugated, then the typingFeatures consist of all subsetted Features, except
/// from CrossSubsetting, and the last chainingFeature (if any). If this Feature is conjugated, then the
/// typingFeatures are only its originalType (if the originalType is a Feature).
/// <strong>Note.</strong> CrossSubsetting is excluded from the determination of the type of a
/// Feature in order to avoid circularity in the construction of implied CrossSubsetting relationships.
/// The validateFeatureCrossFeatureType requires that the crossFeature of a Feature have the same type
/// as the Feature.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// The expected collection of <see cref="IFeature" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IFeature> ComputeTypingFeaturesOperation(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// If isCartesianProduct is true, then return the list of Types whose Cartesian product can be
/// represented by this Feature. (If isCartesianProduct is not true, the operation will still return a
/// valid value, it will just not represent anything useful.)
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// The expected collection of <see cref="IType" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IType> ComputeAsCartesianProductOperation(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Check whether this Feature can be used to represent a Cartesian product of Types.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// The expected <see cref="bool" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static bool ComputeIsCartesianProductOperation(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Return whether this Feature is an owned cross Feature of an end Feature.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// The expected <see cref="bool" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static bool ComputeIsOwnedCrossFeatureOperation(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// If this Feature is an end Feature of its owningType, then return the first ownedMember of the
/// Feature that is a Feature, but not a Multiplicity or a MetadataFeature, and whose owningMembership
/// is not a FeatureMembership. If this exists, it is the crossFeature of the end Feature.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// The expected <see cref="IFeature" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static IFeature ComputeOwnedCrossFeatureOperation(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Return this Feature and all the Features that are directly or indirectly Redefined by this Feature.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <returns>
/// The expected collection of <see cref="IFeature" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static List<IFeature> ComputeAllRedefinedFeaturesOperation(this IFeature featureSubject)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Return if the featuringTypes of this Feature are compatible with the given type. If type is null,
/// then check if this Feature is explicitly or implicitly featured by Base::Anything. If this Feature
/// has isVariable = true, then also consider it to be featured within its owningType. If this Feature
/// is a feature chain whose first chainingFeature has isVariable = true, then also consider it to be
/// featured within the owningType of its first chainingFeature.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <param name="type">
/// No documentation provided
/// </param>
/// <returns>
/// The expected <see cref="bool" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static bool ComputeIsFeaturedWithinOperation(this IFeature featureSubject, IType type)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// A Feature can access another feature if the other feature is featured within one of the direct or
/// indirect featuringTypes of this Feature.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <param name="feature">
/// No documentation provided
/// </param>
/// <returns>
/// The expected <see cref="bool" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static bool ComputeCanAccessOperation(this IFeature featureSubject, IFeature feature)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
/// <summary>
/// Return whether the given type must be a featuringType of this Feature. If this Feature has
/// isVariable = false, then return true if the type is the owningType of the Feature. If isVariable =
/// true, then return true if the type is a Feature representing the snapshots of the owningType of this
/// Feature.
/// </summary>
/// <param name="featureSubject">
/// The subject <see cref="IFeature"/>
/// </param>
/// <param name="type">
/// No documentation provided
/// </param>
/// <returns>
/// The expected <see cref="bool" />
/// </returns>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static bool ComputeIsFeaturingTypeOperation(this IFeature featureSubject, IType type)
{
throw new NotSupportedException("Create a GitHub issue when this method is required");
}
}
}