Skip to content

Commit 8bd3c33

Browse files
Requested changes
1 parent 526e8e3 commit 8bd3c33

4 files changed

Lines changed: 61 additions & 14 deletions

File tree

SysML2.NET/Comparer/NullableStringEqualityComparer.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ namespace SysML2.NET.Comparer
2929
public sealed class NullSafeStringComparer : IEqualityComparer<string>
3030
{
3131
/// <summary>Determines whether the specified objects are equal.</summary>
32-
/// <param name="x">The first object of type <paramref name="T" /> to compare.</param>
33-
/// <param name="y">The second object of type <paramref name="T" /> to compare.</param>
32+
/// <param name="x">The first <see cref="string"/> to compare.</param>
33+
/// <param name="y">The second <see cref="string"/> to compare.</param>
3434
/// <returns>
3535
/// <see langword="true" /> if the specified objects are equal; otherwise, <see langword="false" />.</returns>
3636
public bool Equals(string x, string y)
@@ -49,9 +49,8 @@ public bool Equals(string x, string y)
4949
}
5050

5151
/// <summary>Returns a hash code for the specified object.</summary>
52-
/// <param name="obj">The <see cref="T:System.Object" /> for which a hash code is to be returned.</param>
52+
/// <param name="obj">The nullable <see cref="string"/> for which a hash code is to be returned.</param>
5353
/// <returns>A hash code for the specified object.</returns>
54-
/// <exception cref="T:System.ArgumentNullException">The type of <paramref name="obj" /> is a reference type and <paramref name="obj" /> is <see langword="null" />.</exception>
5554
public int GetHashCode(string? obj)
5655
{
5756
return obj?.GetHashCode() ?? 0;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// -------------------------------------------------------------------------------------------------
2+
// <copyright file="IncompleteModelException.cs" company="Starion Group S.A.">
3+
//
4+
// Copyright 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+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// </copyright>
19+
// ------------------------------------------------------------------------------------------------
20+
21+
namespace SysML2.NET.Exceptions
22+
{
23+
using System;
24+
25+
/// <summary>
26+
/// The <see cref="ModelException"/> provide custom exception that should be used when a SysML 2 is incomplete and is not compliant with defined multiplicity
27+
/// </summary>
28+
public class IncompleteModelException: Exception
29+
{
30+
/// <summary>Initializes a new instance of the <see cref="IncompleteModelException" /> class.</summary>
31+
public IncompleteModelException()
32+
{
33+
}
34+
35+
/// <summary>Initializes a new instance of the <see cref="IncompleteModelException" /> class with a specified error message.</summary>
36+
/// <param name="message">The message that describes the error.</param>
37+
public IncompleteModelException(string message) : base(message)
38+
{
39+
}
40+
41+
/// <summary>Initializes a new instance of the <see cref="IncompleteModelException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
42+
/// <param name="message">The error message that explains the reason for the exception.</param>
43+
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (<see langword="Nothing" /> in Visual Basic) if no inner exception is specified.</param>
44+
public IncompleteModelException(string message, Exception innerException) : base(message, innerException)
45+
{
46+
}
47+
}
48+
}

SysML2.NET/Exceptions/SysML2ModelException.cs renamed to SysML2.NET/Exceptions/ModelException.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// -------------------------------------------------------------------------------------------------
2-
// <copyright file="SysMl2ModelException.cs" company="Starion Group S.A.">
2+
// <copyright file="ModelException.cs" company="Starion Group S.A.">
33
//
44
// Copyright 2022-2026 Starion Group S.A.
55
//
@@ -23,25 +23,25 @@ namespace SysML2.NET.Exceptions
2323
using System;
2424

2525
/// <summary>
26-
/// The <see cref="SysMl2ModelException"/> provide custom exception that should be used when a SysML 2 rule violation appears into a model
26+
/// The <see cref="ModelException"/> provide custom exception that should be used when a SysML 2 constraint violation appears into a model
2727
/// </summary>
28-
public class SysMl2ModelException: Exception
28+
public class ModelException: Exception
2929
{
30-
/// <summary>Initializes a new instance of the <see cref="SysMl2ModelException" /> class.</summary>
31-
public SysMl2ModelException()
30+
/// <summary>Initializes a new instance of the <see cref="ModelException" /> class.</summary>
31+
public ModelException()
3232
{
3333
}
3434

35-
/// <summary>Initializes a new instance of the <see cref="SysMl2ModelException" /> class with a specified error message.</summary>
35+
/// <summary>Initializes a new instance of the <see cref="ModelException" /> class with a specified error message.</summary>
3636
/// <param name="message">The message that describes the error.</param>
37-
public SysMl2ModelException(string message) : base(message)
37+
public ModelException(string message) : base(message)
3838
{
3939
}
4040

41-
/// <summary>Initializes a new instance of the <see cref="SysMl2ModelException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
41+
/// <summary>Initializes a new instance of the <see cref="ModelException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
4242
/// <param name="message">The error message that explains the reason for the exception.</param>
4343
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (<see langword="Nothing" /> in Visual Basic) if no inner exception is specified.</param>
44-
public SysMl2ModelException(string message, Exception innerException) : base(message, innerException)
44+
public ModelException(string message, Exception innerException) : base(message, innerException)
4545
{
4646
}
4747
}

SysML2.NET/Extend/OwningMembershipExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ internal static IElement ComputeOwnedMemberElement(this IOwningMembership owning
5151
throw new ArgumentNullException(nameof(owningMembershipSubject));
5252
}
5353

54-
return owningMembershipSubject.OwnedRelatedElement.Count != 1 ? throw new SysMl2ModelException($"{nameof(owningMembershipSubject)} must have exactly one related element") : owningMembershipSubject.OwnedRelatedElement.Single();
54+
return owningMembershipSubject.OwnedRelatedElement.Count != 1 ? throw new IncompleteModelException($"{nameof(owningMembershipSubject)} must have exactly one related element") : owningMembershipSubject.OwnedRelatedElement.Single();
5555
}
5656

5757
/// <summary>

0 commit comments

Comments
 (0)