-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Update] PropertyExtensions [Change] namespace of extensions methods in uml4net core library to not cause conflct on unl4net.extensions [Refactor] Assembler.TryGetReferencedElement [Implement] ModelInspector
- Loading branch information
1 parent
a3c2bff
commit 5b871f7
Showing
224 changed files
with
1,159 additions
and
1,028 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// <copyright file="MultiplicityElementExtensions.cs" company="Starion Group S.A."> | ||
// | ||
// Copyright 2019-2024 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, softwareUseCases | ||
// 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 uml4net.Extensions | ||
{ | ||
using System; | ||
|
||
using uml4net.POCO.CommonStructure; | ||
using uml4net.POCO.Values; | ||
|
||
/// <summary> | ||
/// Extension methods for <see cref="IMultiplicityElement"/> interface | ||
/// </summary> | ||
public static class MultiplicityElementExtensions | ||
{ | ||
/// <summary> | ||
/// Queries the upper value of the <paramref name="multiplicityElement"/> | ||
/// </summary> | ||
/// <param name="multiplicityElement"> | ||
/// The <see cref="IMultiplicityElement"/> for which the lower value is queried | ||
/// </param> | ||
/// <returns> | ||
/// an integer | ||
/// </returns> | ||
public static string QueryUpperValue(this IMultiplicityElement multiplicityElement) | ||
{ | ||
switch (multiplicityElement.UpperValue) | ||
{ | ||
case null: | ||
return "1"; | ||
|
||
case ILiteralInteger literalInteger: | ||
|
||
return literalInteger.Value.ToString(); | ||
|
||
case ILiteralUnlimitedNatural unlimitedNatural: | ||
|
||
if (!unlimitedNatural.Value.HasValue) | ||
{ | ||
return "0"; | ||
} | ||
else | ||
{ | ||
if (unlimitedNatural.Value == int.MaxValue) | ||
{ | ||
return "*"; | ||
} | ||
else | ||
{ | ||
return unlimitedNatural.Value.ToString(); | ||
} | ||
} | ||
|
||
default: | ||
throw new NotSupportedException(""); | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.