Skip to content

Commit 55c4a13

Browse files
committed
SYSML2_-222 Implemented TransitionUsage::sourceFeature operation.
1 parent a9f444c commit 55c4a13

5 files changed

Lines changed: 55 additions & 13 deletions

File tree

org.omg.sysml/model/SysML.genmodel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,10 +1264,10 @@
12641264
</genPackages>
12651265
<genPackages xsi:type="genmodel:GenPackage" prefix="Types" basePackage="org.omg.sysml.lang"
12661266
disposableProviderFactory="true" ecorePackage="types.ecore#/">
1267+
<genDataTypes xsi:type="genmodel:GenDataType" ecoreDataType="types.ecore#//Boolean"/>
12671268
<genDataTypes xsi:type="genmodel:GenDataType" ecoreDataType="types.ecore#//Integer"/>
12681269
<genDataTypes xsi:type="genmodel:GenDataType" ecoreDataType="types.ecore#//Real"/>
1269-
<genDataTypes xsi:type="genmodel:GenDataType" ecoreDataType="types.ecore#//String"/>
12701270
<genDataTypes xsi:type="genmodel:GenDataType" ecoreDataType="types.ecore#//UnlimitedNatural"/>
1271-
<genDataTypes xsi:type="genmodel:GenDataType" ecoreDataType="types.ecore#//Boolean"/>
1271+
<genDataTypes xsi:type="genmodel:GenDataType" ecoreDataType="types.ecore#//String"/>
12721272
</genPackages>
12731273
</genmodel:GenModel>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*******************************************************************************
2+
* SysML 2 Pilot Implementation
3+
* Copyright (c) 2024 Model Driven Solutions, Inc.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*
18+
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
19+
*
20+
*******************************************************************************/
21+
22+
package org.omg.sysml.delegate.invocation;
23+
24+
import java.lang.reflect.InvocationTargetException;
25+
26+
import org.eclipse.emf.common.util.EList;
27+
import org.eclipse.emf.ecore.EOperation;
28+
import org.eclipse.emf.ecore.InternalEObject;
29+
import org.eclipse.emf.ecore.util.BasicInvocationDelegate;
30+
import org.omg.sysml.lang.sysml.Feature;
31+
import org.omg.sysml.lang.sysml.TransitionUsage;
32+
import org.omg.sysml.util.UsageUtil;
33+
34+
public class TransitionUsage_sourceFeature_InvocationDelegate extends BasicInvocationDelegate {
35+
36+
public TransitionUsage_sourceFeature_InvocationDelegate(EOperation operation) {
37+
super(operation);
38+
}
39+
40+
@Override
41+
public Feature dynamicInvoke(InternalEObject target, EList<?> arguments) throws InvocationTargetException {
42+
TransitionUsage self = (TransitionUsage) target;
43+
return UsageUtil.getSourceFeatureOf(self);
44+
}
45+
46+
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121

2222
package org.omg.sysml.delegate.setting;
2323

24-
import org.eclipse.emf.common.util.EList;
2524
import org.eclipse.emf.ecore.EStructuralFeature;
2625
import org.eclipse.emf.ecore.InternalEObject;
2726
import org.omg.sysml.lang.sysml.Feature;
27+
import org.omg.sysml.util.FeatureUtil;
2828

2929
public class Feature_featureTarget_SettingDelegate extends BasicDerivedObjectSettingDelegate {
3030

@@ -35,8 +35,7 @@ public Feature_featureTarget_SettingDelegate(EStructuralFeature eStructuralFeatu
3535
@Override
3636
protected Feature basicGet(InternalEObject owner) {
3737
Feature feature = (Feature)owner;
38-
EList<Feature> chainingFeatures = feature.getChainingFeature();
39-
return chainingFeatures.isEmpty()? feature: chainingFeatures.get(chainingFeatures.size() - 1);
38+
return FeatureUtil.getBasicFeatureOf(feature);
4039
}
4140

4241
}

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@
2222

2323
package org.omg.sysml.delegate.setting;
2424

25-
import org.eclipse.emf.ecore.EObject;
2625
import org.eclipse.emf.ecore.EStructuralFeature;
2726
import org.eclipse.emf.ecore.InternalEObject;
2827
import org.omg.sysml.lang.sysml.Feature;
2928
import org.omg.sysml.lang.sysml.TransitionUsage;
30-
import org.omg.sysml.util.FeatureUtil;
31-
import org.omg.sysml.util.UsageUtil;
3229

3330
public class TransitionUsage_source_SettingDelegate extends BasicDerivedObjectSettingDelegate {
3431

@@ -37,9 +34,9 @@ public TransitionUsage_source_SettingDelegate(EStructuralFeature eStructuralFeat
3734
}
3835

3936
@Override
40-
protected EObject basicGet(InternalEObject owner) {
41-
Feature source = UsageUtil.getSourceFeatureOf((TransitionUsage)owner);
42-
return source == null? null: FeatureUtil.getBasicFeatureOf(source);
37+
protected Feature basicGet(InternalEObject owner) {
38+
Feature source = ((TransitionUsage)owner).sourceFeature();
39+
return source == null? null: source.getFeatureTarget();
4340
}
4441

4542
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
33
* Copyright (c) 2022 Siemens AG
4+
* Copyright (c) 2024 Model Driven Solutions, Inc.
45
*
56
* This program is free software: you can redistribute it and/or modify
67
* it under the terms of the GNU Lesser General Public License as published by
@@ -28,7 +29,6 @@
2829
import org.omg.sysml.lang.sysml.ActionUsage;
2930
import org.omg.sysml.lang.sysml.Feature;
3031
import org.omg.sysml.lang.sysml.TransitionUsage;
31-
import org.omg.sysml.util.FeatureUtil;
3232

3333
public class TransitionUsage_target_SettingDelegate extends BasicDerivedObjectSettingDelegate {
3434

@@ -42,7 +42,7 @@ protected EObject basicGet(InternalEObject owner) {
4242
if (relatedFeatures.size() < 2) {
4343
return null;
4444
} else {
45-
Feature target = FeatureUtil.getBasicFeatureOf(relatedFeatures.get(1));
45+
Feature target = relatedFeatures.get(1).getFeatureTarget();
4646
return target instanceof ActionUsage? (ActionUsage)target: null;
4747
}
4848
}

0 commit comments

Comments
 (0)