11/*******************************************************************************
22 * SysML 2 Pilot Implementation
3- * Copyright (c) 2022 Model Driven Solutions, Inc.
3+ * Copyright (c) 2022, 2023 Model Driven Solutions, Inc.
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU Lesser General Public License as published by
2222package org .omg .sysml .delegate ;
2323
2424import java .util .HashSet ;
25- import java .util .List ;
2625import java .util .Set ;
2726
2827import org .eclipse .emf .ecore .EStructuralFeature ;
2928import org .eclipse .emf .ecore .InternalEObject ;
3029import org .omg .sysml .lang .sysml .Membership ;
3130import org .omg .sysml .lang .sysml .Multiplicity ;
3231import org .omg .sysml .lang .sysml .Type ;
33- import org .omg .sysml .lang .sysml .impl .TypeImpl ;
34- import org .omg .sysml .util .TypeUtil ;
3532
3633public class Type_multiplicity_SettingDelegate extends BasicDerivedObjectSettingDelegate {
3734
@@ -45,21 +42,10 @@ protected Multiplicity basicGet(InternalEObject owner) {
4542 }
4643
4744 protected static Multiplicity getMultiplicityOf (Type type , Set <Type > visited ) {
48- Multiplicity multiplicity = (Multiplicity )type .getOwnedMembership ().stream ().
45+ return (Multiplicity )type .getOwnedMembership ().stream ().
4946 map (Membership ::getMemberElement ).
5047 filter (Multiplicity .class ::isInstance ).
5148 findFirst ().orElse (null );
52- if (multiplicity == null ) {
53- visited .add (type );
54- List <Type > superTypes = TypeUtil .getSupertypesOf (type );
55- if (!superTypes .isEmpty ()) {
56- Type general = TypeUtil .getSupertypesOf (type ).get (0 );
57- if (general != null && !visited .contains (general )) {
58- multiplicity = getMultiplicityOf ((TypeImpl )general , visited );
59- }
60- }
61- }
62- return multiplicity ;
6349 }
6450
6551}
0 commit comments