Skip to content

Commit 1f2fc32

Browse files
committed
ST6RI-899 Revised delegate for derivation of enumeratedValue.
Implemented an explicit filter on EnumerationUsage instead of using DerivedEObjectEList.
1 parent 725b3b6 commit 1f2fc32

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

org.omg.sysml/src/org/omg/sysml/delegate/setting/EnumerationDefinition_enumeratedValue_SettingDelegate.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2022 Siemens AG
3+
* Copyright (c) 2022, 2025 Siemens AG
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
@@ -24,19 +24,23 @@
2424
import org.eclipse.emf.common.util.EList;
2525
import org.eclipse.emf.ecore.EStructuralFeature;
2626
import org.eclipse.emf.ecore.InternalEObject;
27-
import org.eclipse.uml2.common.util.DerivedEObjectEList;
2827
import org.omg.sysml.lang.sysml.EnumerationUsage;
29-
import org.omg.sysml.lang.sysml.SysMLPackage;
28+
import org.omg.sysml.util.NonNotifyingEObjectEList;
3029

31-
public class EnumerationDefinition_enumeratedValue_SettingDelegate extends BasicDerivedListSettingDelegate {
30+
public class EnumerationDefinition_enumeratedValue_SettingDelegate extends Definition_variant_SettingDelegate {
3231

3332
public EnumerationDefinition_enumeratedValue_SettingDelegate(EStructuralFeature eStructuralFeature) {
3433
super(eStructuralFeature);
3534
}
3635

3736
@Override
3837
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;
4044
}
4145

4246
}

0 commit comments

Comments
 (0)