|
1 | 1 | /******************************************************************************* |
2 | 2 | * SysML 2 Pilot Implementation |
3 | | - * Copyright (c) 2022 Siemens AG |
| 3 | + * Copyright (c) 2022, 2025 Siemens AG |
4 | 4 | * |
5 | 5 | * This program is free software: you can redistribute it and/or modify |
6 | 6 | * it under the terms of the GNU Lesser General Public License as published by |
|
24 | 24 | import org.eclipse.emf.common.util.EList; |
25 | 25 | import org.eclipse.emf.ecore.EStructuralFeature; |
26 | 26 | import org.eclipse.emf.ecore.InternalEObject; |
27 | | -import org.eclipse.uml2.common.util.DerivedEObjectEList; |
28 | 27 | import org.omg.sysml.lang.sysml.EnumerationUsage; |
29 | | -import org.omg.sysml.lang.sysml.SysMLPackage; |
| 28 | +import org.omg.sysml.util.NonNotifyingEObjectEList; |
30 | 29 |
|
31 | | -public class EnumerationDefinition_enumeratedValue_SettingDelegate extends BasicDerivedListSettingDelegate { |
| 30 | +public class EnumerationDefinition_enumeratedValue_SettingDelegate extends Definition_variant_SettingDelegate { |
32 | 31 |
|
33 | 32 | public EnumerationDefinition_enumeratedValue_SettingDelegate(EStructuralFeature eStructuralFeature) { |
34 | 33 | super(eStructuralFeature); |
35 | 34 | } |
36 | 35 |
|
37 | 36 | @Override |
38 | 37 | protected EList<?> basicGet(InternalEObject owner) { |
39 | | - return new DerivedEObjectEList<>(EnumerationUsage.class, owner, SysMLPackage.ENUMERATION_DEFINITION__ENUMERATED_VALUE, new int[] {SysMLPackage.DEFINITION__VARIANT}); |
| 38 | + EList<EnumerationUsage> enumeratedValues = new NonNotifyingEObjectEList<>(EnumerationUsage.class, owner, eStructuralFeature.getFeatureID()); |
| 39 | + super.basicGet(owner).stream(). |
| 40 | + filter(EnumerationUsage.class::isInstance). |
| 41 | + map(EnumerationUsage.class::cast). |
| 42 | + forEachOrdered(enumeratedValues::add); |
| 43 | + return enumeratedValues; |
40 | 44 | } |
41 | 45 |
|
42 | 46 | } |
0 commit comments