Skip to content

Commit 7e60391

Browse files
committed
ST6RI-795 Refactored signatures of inheritance computation methods.
1 parent 8558fd2 commit 7e60391

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

org.omg.sysml/src/org/omg/sysml/adapter/FeatureAdapter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ public Feature getTarget() {
7575
// Inheritance
7676

7777
@Override
78-
public EList<Membership> getInheritedMembership(Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes,
79-
boolean includeProtected, boolean excludeImplied, Collection<Feature> redefinedFeatures) {
80-
EList<Membership> inheritedMemberships = super.getInheritedMembership(excludedNamespaces, excludedTypes, includeProtected, excludeImplied, redefinedFeatures);
78+
public EList<Membership> getInheritedMembership(Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes, Collection<Feature> redefinedFeatures,
79+
boolean includeProtected, boolean excludeImplied) {
80+
EList<Membership> inheritedMemberships = super.getInheritedMembership(excludedNamespaces, excludedTypes, redefinedFeatures, includeProtected, excludeImplied);
8181
EList<FeatureChaining> featureChainings = getTarget().getOwnedFeatureChaining();
8282
if (!featureChainings.isEmpty()) {
8383
Feature chainingFeature = featureChainings.get(featureChainings.size()-1).getChainingFeature();
8484
if (chainingFeature != null && !excludedTypes.contains(chainingFeature)) {
85-
inheritedMemberships.addAll(TypeUtil.getNonPrivateMembershipFor(chainingFeature, excludedNamespaces, excludedTypes, includeProtected, excludeImplied, redefinedFeatures));
85+
inheritedMemberships.addAll(TypeUtil.getNonPrivateMembershipFor(chainingFeature, excludedNamespaces, excludedTypes, redefinedFeatures, includeProtected, excludeImplied));
8686
}
8787
}
8888
return inheritedMemberships;

org.omg.sysml/src/org/omg/sysml/adapter/TypeAdapter.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,51 +74,51 @@ public Type getTarget() {
7474
@Override
7575
public EList<Membership> getVisibleMemberships(Collection<org.omg.sysml.lang.sysml.Namespace> excludedNamespaces, Collection<Type> excludedTypes, boolean includeAll, boolean excludeImplied) {
7676
EList<Membership> visibleMembership = super.getVisibleMemberships(excludedNamespaces, excludedTypes, includeAll, excludeImplied);
77-
visibleMembership.addAll(getInheritedMembership(excludedNamespaces, excludedTypes, includeAll, excludeImplied, new HashSet<>()));
77+
visibleMembership.addAll(getInheritedMembership(excludedNamespaces, excludedTypes, new HashSet<>(), includeAll, excludeImplied));
7878
return visibleMembership;
7979
}
8080

81-
public EList<Membership> getNonPrivateMembership(Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes,
82-
boolean includeProtected, boolean excludeImplied, Collection<Feature> redefinedFeatures) {
81+
public EList<Membership> getNonPrivateMembership(Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes, Collection<Feature> redefinedFeatures,
82+
boolean includeProtected, boolean excludeImplied) {
8383
EList<Membership> nonPrivateMembership = super.getVisibleMemberships(excludedNamespaces, excludedTypes, false, excludeImplied);
8484
if (includeProtected) {
8585
nonPrivateMembership.addAll(getVisibleOwnedMembership(VisibilityKind.PROTECTED));
8686
}
8787
removeRedefinedFeatures(nonPrivateMembership, redefinedFeatures);
88-
nonPrivateMembership.addAll(getInheritedMembership(excludedNamespaces, excludedTypes, includeProtected, excludeImplied, redefinedFeatures));
88+
nonPrivateMembership.addAll(getInheritedMembership(excludedNamespaces, excludedTypes, redefinedFeatures, includeProtected, excludeImplied));
8989
return nonPrivateMembership;
9090
}
9191

92-
public EList<Membership> getInheritedMembership(Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes,
93-
boolean includeProtected, boolean excludeImplied, Collection<Feature> redefinedFeatures) {
92+
public EList<Membership> getInheritedMembership(Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes, Collection<Feature> redefinedFeatures,
93+
boolean includeProtected, boolean excludeImplied) {
9494
EList<Membership> inheritedMemberships = new BasicInternalEList<Membership>(Membership.class);
9595
Type target = getTarget();
9696
excludedTypes.add(target);
9797
Conjugation conjugator = target.getOwnedConjugator();
9898
if (conjugator != null) {
9999
Type originalType = conjugator.getOriginalType();
100100
if (originalType != null && !excludedTypes.contains(originalType)) {
101-
inheritedMemberships.addAll(TypeUtil.getMembershipFor(originalType, excludedNamespaces, excludedTypes, includeProtected, excludeImplied, redefinedFeatures));
101+
inheritedMemberships.addAll(TypeUtil.getMembershipFor(originalType, excludedNamespaces, excludedTypes, redefinedFeatures, includeProtected, excludeImplied));
102102
}
103103
}
104104
Collection<Feature> newRedefinedFeatures = new HashSet<>(redefinedFeatures);
105105
newRedefinedFeatures.addAll(getAllFeaturesRedefinedByType());
106106
for (Type general: TypeUtil.getGeneralTypesOf(target)) {
107107
if (general != null && !excludedTypes.contains(general)) {
108-
inheritedMemberships.addAll(TypeUtil.getNonPrivateMembershipFor(general, excludedNamespaces, excludedTypes, includeProtected, excludeImplied, newRedefinedFeatures));
108+
inheritedMemberships.addAll(TypeUtil.getNonPrivateMembershipFor(general, excludedNamespaces, excludedTypes, newRedefinedFeatures, includeProtected, excludeImplied));
109109
}
110110
}
111111
return inheritedMemberships;
112112
}
113113

114114
public EList<Membership> getMembership(Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes,
115-
boolean includeProtected, boolean excludeImplied, Collection<Feature> redefinedFeatures) {
115+
Collection<Feature> redefinedFeatures, boolean includeProtected, boolean excludeImplied) {
116116
Type target = getTarget();
117117
EList<Membership> membership = new BasicInternalEList<>(Membership.class);
118118
membership.addAll(target.getOwnedMembership());
119119
membership.addAll(getImportedMembership(excludedNamespaces, excludedTypes, false));
120120
removeRedefinedFeatures(membership, redefinedFeatures);
121-
membership.addAll(getInheritedMembership(excludedNamespaces, excludedTypes, includeProtected, excludeImplied, redefinedFeatures));
121+
membership.addAll(getInheritedMembership(excludedNamespaces, excludedTypes, redefinedFeatures, includeProtected, excludeImplied));
122122
return membership;
123123
}
124124

org.omg.sysml/src/org/omg/sysml/delegate/invocation/Type_inheritedMemberships_InvocationDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public Object dynamicInvoke(InternalEObject target, EList<?> arguments) throws I
4444
EList<Type> excluded = (EList<Type>) arguments.get(0);
4545
boolean excludeImplied = (boolean) arguments.get(1);
4646

47-
return TypeUtil.getInheritedMembershipFor(self, new HashSet<Namespace>(), new HashSet<>(excluded), true, excludeImplied, new HashSet<>());
47+
return TypeUtil.getInheritedMembershipFor(self, new HashSet<Namespace>(), new HashSet<>(excluded), new HashSet<>(), true, excludeImplied);
4848
}
4949

5050
}

org.omg.sysml/src/org/omg/sysml/util/TypeUtil.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ protected static TypeAdapter getTypeAdapter(Type target) {
6767

6868
// Inheritance
6969

70-
public static EList<Membership> getMembershipFor(Type type, Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes, boolean includeProtected, boolean excludeImplied, Collection<Feature> redefinedFeatures) {
71-
return getTypeAdapter(type).getMembership(excludedNamespaces, excludedTypes, includeProtected, excludeImplied, redefinedFeatures);
70+
public static EList<Membership> getMembershipFor(Type type, Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes, Collection<Feature> redefinedFeatures, boolean includeProtected, boolean excludeImplied) {
71+
return getTypeAdapter(type).getMembership(excludedNamespaces, excludedTypes, redefinedFeatures, includeProtected, excludeImplied);
7272
}
7373

74-
public static EList<Membership> getNonPrivateMembershipFor(Type type, Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes, boolean includeProtected, boolean excludeImplied, Collection<Feature> redefinedFeatures) {
75-
return getTypeAdapter(type).getNonPrivateMembership(excludedNamespaces, excludedTypes, includeProtected, excludeImplied, redefinedFeatures);
74+
public static EList<Membership> getNonPrivateMembershipFor(Type type, Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes, Collection<Feature> redefinedFeatures, boolean includeProtected, boolean excludeImplied) {
75+
return getTypeAdapter(type).getNonPrivateMembership(excludedNamespaces, excludedTypes, redefinedFeatures, includeProtected, excludeImplied);
7676
}
7777

78-
public static EList<Membership> getInheritedMembershipFor(Type type, Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes, boolean includeProtected, boolean excludeImplied, Collection<Feature> redefinedFeatures) {
79-
return getTypeAdapter(type).getInheritedMembership(excludedNamespaces, excludedTypes, includeProtected, excludeImplied, redefinedFeatures);
78+
public static EList<Membership> getInheritedMembershipFor(Type type, Collection<Namespace> excludedNamespaces, Collection<Type> excludedTypes, Collection<Feature> redefinedFeatures, boolean includeProtected, boolean excludeImplied) {
79+
return getTypeAdapter(type).getInheritedMembership(excludedNamespaces, excludedTypes, redefinedFeatures, includeProtected, excludeImplied);
8080
}
8181

8282
public static Collection<Feature> getAllFeaturesRedefinedBy(Type type) {

0 commit comments

Comments
 (0)