|
1 | 1 | // ------------------------------------------------------------------------------------------------- |
2 | 2 | // <copyright file="InterfaceDefinitionExtensions.cs" company="Starion Group S.A."> |
3 | | -// |
4 | | -// Copyright (C) 2022-2026 Starion Group S.A. |
5 | | -// |
6 | | -// Licensed under the Apache License, Version 2.0 (the "License"); |
7 | | -// you may not use this file except in compliance with the License. |
8 | | -// You may obtain a copy of the License at |
9 | | -// |
| 3 | +// |
| 4 | +// Copyright (C) 2022-2026 Starion Group S.A. |
| 5 | +// |
| 6 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +// you may not use this file except in compliance with the License. |
| 8 | +// You may obtain a copy of the License at |
| 9 | +// |
10 | 10 | // http://www.apache.org/licenses/LICENSE-2.0 |
11 | | -// |
| 11 | +// |
12 | 12 | // Unless required by applicable law or agreed to in writing, software |
13 | 13 | // distributed under the License is distributed on an "AS IS" BASIS, |
14 | 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | 15 | // See the License for the specific language governing permissions and |
16 | 16 | // limitations under the License. |
17 | | -// |
| 17 | +// |
18 | 18 | // </copyright> |
19 | 19 | // ------------------------------------------------------------------------------------------------ |
20 | 20 |
|
21 | 21 | namespace SysML2.NET.Core.POCO.Systems.Interfaces |
22 | 22 | { |
23 | 23 | using System; |
24 | 24 | using System.Collections.Generic; |
| 25 | + using System.Linq; |
25 | 26 |
|
26 | | - using SysML2.NET.Core.Core.Types; |
27 | | - using SysML2.NET.Core.Root.Namespaces; |
28 | | - using SysML2.NET.Core.POCO.Core.Classifiers; |
29 | | - using SysML2.NET.Core.POCO.Core.Features; |
30 | | - using SysML2.NET.Core.POCO.Core.Types; |
31 | | - using SysML2.NET.Core.POCO.Kernel.Associations; |
32 | | - using SysML2.NET.Core.POCO.Root.Annotations; |
33 | | - using SysML2.NET.Core.POCO.Root.Elements; |
34 | | - using SysML2.NET.Core.POCO.Root.Namespaces; |
35 | | - using SysML2.NET.Core.POCO.Systems.Actions; |
36 | | - using SysML2.NET.Core.POCO.Systems.Allocations; |
37 | | - using SysML2.NET.Core.POCO.Systems.AnalysisCases; |
38 | | - using SysML2.NET.Core.POCO.Systems.Attributes; |
39 | | - using SysML2.NET.Core.POCO.Systems.Calculations; |
40 | | - using SysML2.NET.Core.POCO.Systems.Cases; |
41 | | - using SysML2.NET.Core.POCO.Systems.Connections; |
42 | | - using SysML2.NET.Core.POCO.Systems.Constraints; |
43 | | - using SysML2.NET.Core.POCO.Systems.DefinitionAndUsage; |
44 | | - using SysML2.NET.Core.POCO.Systems.Enumerations; |
45 | | - using SysML2.NET.Core.POCO.Systems.Flows; |
46 | | - using SysML2.NET.Core.POCO.Systems.Items; |
47 | | - using SysML2.NET.Core.POCO.Systems.Metadata; |
48 | | - using SysML2.NET.Core.POCO.Systems.Occurrences; |
49 | | - using SysML2.NET.Core.POCO.Systems.Parts; |
50 | 27 | using SysML2.NET.Core.POCO.Systems.Ports; |
51 | | - using SysML2.NET.Core.POCO.Systems.Requirements; |
52 | | - using SysML2.NET.Core.POCO.Systems.States; |
53 | | - using SysML2.NET.Core.POCO.Systems.UseCases; |
54 | | - using SysML2.NET.Core.POCO.Systems.VerificationCases; |
55 | | - using SysML2.NET.Core.POCO.Systems.Views; |
56 | 28 |
|
57 | 29 | /// <summary> |
58 | | - /// The <see cref="InterfaceDefinitionExtensions"/> class provides extensions methods for |
59 | | - /// the <see cref="IInterfaceDefinition"/> interface |
| 30 | + /// The <see cref="InterfaceDefinitionExtensions" /> class provides extensions methods for |
| 31 | + /// the <see cref="IInterfaceDefinition" /> interface |
60 | 32 | /// </summary> |
61 | 33 | internal static class InterfaceDefinitionExtensions |
62 | 34 | { |
63 | 35 | /// <summary> |
64 | 36 | /// Computes the derived property. |
65 | 37 | /// </summary> |
66 | 38 | /// <param name="interfaceDefinitionSubject"> |
67 | | - /// The subject <see cref="IInterfaceDefinition"/> |
| 39 | + /// The subject <see cref="IInterfaceDefinition" /> |
68 | 40 | /// </param> |
69 | 41 | /// <returns> |
70 | 42 | /// the computed result |
71 | 43 | /// </returns> |
72 | | - [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] |
73 | 44 | internal static List<IPortUsage> ComputeInterfaceEnd(this IInterfaceDefinition interfaceDefinitionSubject) |
74 | 45 | { |
75 | | - throw new NotSupportedException("Create a GitHub issue when this method is required"); |
| 46 | + return interfaceDefinitionSubject == null |
| 47 | + ? throw new ArgumentNullException(nameof(interfaceDefinitionSubject)) |
| 48 | + : [..interfaceDefinitionSubject.feature.Where(feature => feature.IsEnd).OfType<IPortUsage>()]; |
76 | 49 | } |
77 | | - |
78 | 50 | } |
79 | 51 | } |
0 commit comments