Skip to content

Commit a327aa7

Browse files
committed
ST6RI-897 Moved overrides of isComposite into adapter postProcess.
- For UsageImpl and PortIsageImpl
1 parent 2e0a662 commit a327aa7

5 files changed

Lines changed: 30 additions & 42 deletions

File tree

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2021, 2022, 2025 Model Driven Solutions, Inc.
3+
* Copyright (c) 2021, 2022, 2025, 2026 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
@@ -21,6 +21,8 @@
2121

2222
package org.omg.sysml.adapter;
2323

24+
import org.eclipse.emf.ecore.EObject;
25+
import org.omg.sysml.lang.sysml.FeatureMembership;
2426
import org.omg.sysml.lang.sysml.PartDefinition;
2527
import org.omg.sysml.lang.sysml.PartUsage;
2628
import org.omg.sysml.lang.sysml.PortDefinition;
@@ -37,6 +39,21 @@ public PortUsage getTarget() {
3739
return (PortUsage)super.getTarget();
3840
}
3941

42+
/**
43+
* @satisfies validatePortUsageIsReference
44+
*/
45+
public void postProcess() {
46+
super.postProcess();
47+
PortUsage target = getTarget();
48+
EObject container = target.eContainer();
49+
if (container instanceof FeatureMembership) {
50+
Type owningType = ((FeatureMembership)container).getOwningType();
51+
if (!(owningType instanceof PortDefinition || owningType instanceof PortUsage)) {
52+
target.setIsComposite(false);
53+
}
54+
}
55+
}
56+
4057
// Implicit Generalization
4158

4259
@Override

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2021-2025 Model Driven Solutions, Inc.
3+
* Copyright (c) 2021-2025, 2026 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
@@ -53,13 +53,21 @@ public Usage getTarget() {
5353

5454
// Post-processing
5555

56+
/**
57+
* @satisfies validateUsageIsReferential
58+
*/
5659
@Override
5760
public void postProcess () {
5861
super.postProcess();
5962
Usage target = getTarget();
6063
if (target.isVariation()) {
6164
target.setIsAbstract(true);
6265
}
66+
if (target.getDirection() != null || target.isEnd() ||
67+
// Note: A parsed Usage can only get a featuring type if it is owned via a FeatureMembership.
68+
!(target.eContainer() instanceof FeatureMembership)) {
69+
target.setIsComposite(false);
70+
}
6371
}
6472

6573
@Override

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ protected static UsageAdapter getUsageAdapter(Usage usage) {
8585
return (UsageAdapter)ElementUtil.getElementAdapter(usage);
8686
}
8787

88-
// References
89-
90-
public static boolean isComposite(Usage usage, boolean isComposite) {
91-
return isComposite && (usage.getOwningType() != null || !usage.getFeaturingType().isEmpty()) && usage.getDirection() == null && !usage.isEnd();
92-
}
93-
9488
// Time Varying
9589

9690
public static boolean mayTimeVary(Usage usage) {

org.omg.sysml/syntax-gen/org/omg/sysml/lang/sysml/impl/PortUsageImpl.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2020-2022 Model Driven Solutions, Inc.
3+
* Copyright (c) 2020-2022, 2026 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
@@ -29,7 +29,6 @@
2929
import org.omg.sysml.lang.sysml.PortDefinition;
3030
import org.omg.sysml.lang.sysml.PortUsage;
3131
import org.omg.sysml.lang.sysml.SysMLPackage;
32-
import org.omg.sysml.lang.sysml.Type;
3332

3433
/**
3534
* <!-- begin-user-doc -->
@@ -115,22 +114,6 @@ public boolean isSetOccurrenceDefinition() {
115114
return false;
116115
}
117116

118-
// Additional overrides
119-
120-
/**
121-
* @generated NOT
122-
*/
123-
@Override
124-
public boolean isComposite() {
125-
Type owningType = getOwningType();
126-
return owningType != null &&
127-
(owningType instanceof PortDefinition ||
128-
owningType instanceof PortUsage) &&
129-
super.isComposite();
130-
}
131-
132-
//
133-
134117
/**
135118
* <!-- begin-user-doc -->
136119
* <!-- end-user-doc -->

org.omg.sysml/syntax-gen/org/omg/sysml/lang/sysml/impl/UsageImpl.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2020-2024 Model Driven Solutions, Inc.
3+
* Copyright (c) 2020-2024, 2026 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
@@ -18,8 +18,7 @@
1818
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
1919
*
2020
*******************************************************************************/
21-
/**
22-
*/
21+
2322
package org.omg.sysml.lang.sysml.impl;
2423

2524
import java.lang.reflect.InvocationTargetException;
@@ -66,7 +65,6 @@
6665
import org.omg.sysml.lang.sysml.VerificationCaseUsage;
6766
import org.omg.sysml.lang.sysml.ViewUsage;
6867
import org.omg.sysml.lang.sysml.ViewpointUsage;
69-
import org.omg.sysml.util.UsageUtil;
7068

7169
/**
7270
* <!-- begin-user-doc -->
@@ -1044,18 +1042,6 @@ public boolean isSetIsVariable() {
10441042
return false;
10451043
}
10461044

1047-
// Additional overrides
1048-
1049-
/**
1050-
* @generated NOT
1051-
*/
1052-
@Override
1053-
public boolean isComposite() {
1054-
return UsageUtil.isComposite(this, isComposite);
1055-
}
1056-
1057-
//
1058-
10591045
/**
10601046
* <!-- begin-user-doc -->
10611047
* <!-- end-user-doc -->

0 commit comments

Comments
 (0)