Skip to content

Commit

Permalink
[175] State transition fixes
Browse files Browse the repository at this point in the history
- Add guardExpression into the transitionExpression rule. Not
  implemented yet.
- Prevent transition creation from or to a parallel state
- Fix delete state and delete transition issues
- Fix direct edit tool on transitions. Is still missing a fully correct
  behavior on unsetting trigger action.
- Adapt transition trigger creation to follow AcceptActionUsage
  modifications about parameters handling
- Modify TransitionUsage creation and connection to its source and
  target to be specification compliant. Required to rewrite the
  reconnect tools, the RelatedElementsSwitch and the TransitionUsage
  source(Feature) target(Feature) relations.
- Add payload and receiver to the trigger action creation

M2 contributions
- Add redefinition of Subsetting.subsettedFeature by
  ReferenceSubsetting.referencedFeature. Updated code in getter and
  setter of subsettedFeature on REeerenceSubsetting to ensure
  consistency.

Limitation: Using the Delete tool on a Transition with a trigger or
an effect causes an error and does not allows to delete the transition.

Bug: #175
Signed-off-by: Arnaud Dieumegard <arnaud.dieumegard@obeo.fr>
  • Loading branch information
arnauddieumegard authored and AxelRICHARD committed May 21, 2024
1 parent df68b90 commit 69960a0
Show file tree
Hide file tree
Showing 15 changed files with 530 additions and 213 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ public Feature basicGetOwnedMemberParameter() {
.findFirst()
.orElse(null);
}

/**
* ownedMemberParameter : Feature {redefines ownedMemberFeature}
* @generated NOT
*/
@Override
public Feature getOwnedMemberFeature() {
return this.getOwnedMemberParameter();
}

/**
* <!-- begin-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,33 @@ public Feature getReferencedFeature() {
}
return referencedFeature;
}

/**
* referencedFeature : Feature {redefines subsettedFeature}.
*
* The Feature that is referenced by the referencingFeature of this ReferenceSubsetting.
*
* @generated NOT
*/
@Override
public Feature getSubsettedFeature() {
return this.getReferencedFeature();
}


/**
* referencedFeature : Feature {redefines subsettedFeature}.
*
* The Feature that is referenced by the referencingFeature of this ReferenceSubsetting.
* Setter.
*
* @generated NOT
*/
@Override
public void setSubsettedFeature(Feature newSubsettedFeature) {
super.setSubsettedFeature(newSubsettedFeature);
this.setReferencedFeature(newSubsettedFeature);
}

/**
* <!-- begin-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.syson.sysml.ActionUsage;
import org.eclipse.syson.sysml.Element;
import org.eclipse.syson.sysml.Expression;
import org.eclipse.syson.sysml.Feature;
import org.eclipse.syson.sysml.FeatureMembership;
import org.eclipse.syson.sysml.Membership;
import org.eclipse.syson.sysml.ReferenceUsage;
Expand Down Expand Up @@ -220,9 +221,9 @@ public ActionUsage getTarget() {
* @generated NOT
*/
public ActionUsage basicGetTarget() {
Succession succession = getSuccession();
if (succession != null && !succession.getTarget().isEmpty()) {
EList<Element> targets = succession.getTarget();
Succession succession = this.getSuccession();
if (succession != null && !succession.getTargetFeature().isEmpty()) {
EList<Feature> targets = succession.getTargetFeature();
if (!targets.isEmpty() && targets.get(0) instanceof ActionUsage actionUsage) {
return actionUsage;
}
Expand Down Expand Up @@ -263,13 +264,18 @@ public EList<AcceptActionUsage> getTriggerAction() {

/**
* <!-- begin-user-doc -->
* Return the payloadParameter of the triggerAction of this TransitionUsage, if it has one.
*
* body: if triggerAction->isEmpty() then null else triggerAction->first().payloadParameter endif
* <!-- end-user-doc -->
* @generated
* @generated NOT
*/
@Override
public ReferenceUsage triggerPayloadParameter() {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
AcceptActionUsage triggerAction = this.getTriggerAction().stream().findFirst().orElse(null);
if (triggerAction != null) {
return triggerAction.getPayloadParameter();
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,16 @@ public EList<Feature> getOwnedFeature() {
}

/**
* <!-- begin-user-doc -->
* <!-- begin-user-doc -->
* The ownedMemberships of this Type that are FeatureMemberships, for which the Type is the
* owningType. Each such FeatureMembership identifies an ownedFeature of the Type.
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public EList<FeatureMembership> getOwnedFeatureMembership() {
List<FeatureMembership> ownedFeatureMemberships = new ArrayList<>();
this.getOwnedRelationship().stream()
this.getOwnedMembership().stream()
.filter(FeatureMembership.class::isInstance)
.map(FeatureMembership.class::cast)
.forEach(ownedFeatureMemberships::add);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,12 @@ typingExpression
valueExpression
transitionExpression
triggerExpression
triggerExpressionName
guardExpression
effectExpression
qualifiedName
name


atn:
[4, 1, 117, 123, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 1, 0, 3, 0, 30, 8, 0, 1, 0, 3, 0, 33, 8, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 42, 8, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 51, 8, 3, 1, 3, 3, 3, 54, 8, 3, 1, 3, 3, 3, 57, 8, 3, 1, 3, 3, 3, 60, 8, 3, 1, 3, 1, 3, 3, 3, 64, 8, 3, 1, 3, 3, 3, 67, 8, 3, 1, 3, 3, 3, 70, 8, 3, 3, 3, 72, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 3, 8, 87, 8, 8, 1, 8, 3, 8, 90, 8, 8, 1, 9, 1, 9, 1, 9, 5, 9, 95, 8, 9, 10, 9, 12, 9, 98, 9, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 108, 8, 11, 10, 11, 12, 11, 111, 9, 11, 1, 12, 1, 12, 1, 12, 5, 12, 116, 8, 12, 10, 12, 12, 12, 119, 9, 12, 1, 13, 1, 13, 1, 13, 0, 0, 14, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 0, 3, 2, 0, 4, 4, 15, 15, 2, 0, 14, 16, 18, 18, 2, 0, 17, 17, 19, 19, 127, 0, 29, 1, 0, 0, 0, 2, 37, 1, 0, 0, 0, 4, 46, 1, 0, 0, 0, 6, 71, 1, 0, 0, 0, 8, 73, 1, 0, 0, 0, 10, 76, 1, 0, 0, 0, 12, 79, 1, 0, 0, 0, 14, 82, 1, 0, 0, 0, 16, 86, 1, 0, 0, 0, 18, 91, 1, 0, 0, 0, 20, 99, 1, 0, 0, 0, 22, 103, 1, 0, 0, 0, 24, 112, 1, 0, 0, 0, 26, 120, 1, 0, 0, 0, 28, 30, 3, 26, 13, 0, 29, 28, 1, 0, 0, 0, 29, 30, 1, 0, 0, 0, 30, 32, 1, 0, 0, 0, 31, 33, 3, 2, 1, 0, 32, 31, 1, 0, 0, 0, 32, 33, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 35, 3, 6, 3, 0, 35, 36, 5, 0, 0, 1, 36, 1, 1, 0, 0, 0, 37, 41, 5, 1, 0, 0, 38, 39, 3, 4, 2, 0, 39, 40, 5, 2, 0, 0, 40, 42, 1, 0, 0, 0, 41, 38, 1, 0, 0, 0, 41, 42, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 44, 3, 4, 2, 0, 44, 45, 5, 3, 0, 0, 45, 3, 1, 0, 0, 0, 46, 47, 7, 0, 0, 0, 47, 5, 1, 0, 0, 0, 48, 51, 3, 8, 4, 0, 49, 51, 3, 10, 5, 0, 50, 48, 1, 0, 0, 0, 50, 49, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 53, 1, 0, 0, 0, 52, 54, 3, 12, 6, 0, 53, 52, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 56, 1, 0, 0, 0, 55, 57, 3, 14, 7, 0, 56, 55, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 72, 1, 0, 0, 0, 58, 60, 3, 12, 6, 0, 59, 58, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 63, 1, 0, 0, 0, 61, 64, 3, 8, 4, 0, 62, 64, 3, 10, 5, 0, 63, 61, 1, 0, 0, 0, 63, 62, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 66, 1, 0, 0, 0, 65, 67, 3, 14, 7, 0, 66, 65, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 72, 1, 0, 0, 0, 68, 70, 3, 16, 8, 0, 69, 68, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 72, 1, 0, 0, 0, 71, 50, 1, 0, 0, 0, 71, 59, 1, 0, 0, 0, 71, 69, 1, 0, 0, 0, 72, 7, 1, 0, 0, 0, 73, 74, 5, 5, 0, 0, 74, 75, 3, 24, 12, 0, 75, 9, 1, 0, 0, 0, 76, 77, 5, 6, 0, 0, 77, 78, 3, 24, 12, 0, 78, 11, 1, 0, 0, 0, 79, 80, 5, 7, 0, 0, 80, 81, 3, 24, 12, 0, 81, 13, 1, 0, 0, 0, 82, 83, 5, 8, 0, 0, 83, 84, 7, 1, 0, 0, 84, 15, 1, 0, 0, 0, 85, 87, 3, 18, 9, 0, 86, 85, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 89, 1, 0, 0, 0, 88, 90, 3, 22, 11, 0, 89, 88, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 17, 1, 0, 0, 0, 91, 96, 3, 24, 12, 0, 92, 93, 5, 9, 0, 0, 93, 95, 3, 24, 12, 0, 94, 92, 1, 0, 0, 0, 95, 98, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 19, 1, 0, 0, 0, 98, 96, 1, 0, 0, 0, 99, 100, 5, 1, 0, 0, 100, 101, 3, 14, 7, 0, 101, 102, 5, 3, 0, 0, 102, 21, 1, 0, 0, 0, 103, 104, 5, 10, 0, 0, 104, 109, 3, 24, 12, 0, 105, 106, 5, 11, 0, 0, 106, 108, 3, 24, 12, 0, 107, 105, 1, 0, 0, 0, 108, 111, 1, 0, 0, 0, 109, 107, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 23, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 112, 117, 3, 26, 13, 0, 113, 114, 5, 12, 0, 0, 114, 116, 3, 26, 13, 0, 115, 113, 1, 0, 0, 0, 116, 119, 1, 0, 0, 0, 117, 115, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 25, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 120, 121, 7, 2, 0, 0, 121, 27, 1, 0, 0, 0, 16, 29, 32, 41, 50, 53, 56, 59, 63, 66, 69, 71, 86, 89, 96, 109, 117]
[4, 1, 117, 132, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 3, 0, 32, 8, 0, 1, 0, 3, 0, 35, 8, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 44, 8, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 53, 8, 3, 1, 3, 3, 3, 56, 8, 3, 1, 3, 3, 3, 59, 8, 3, 1, 3, 3, 3, 62, 8, 3, 1, 3, 1, 3, 3, 3, 66, 8, 3, 1, 3, 3, 3, 69, 8, 3, 1, 3, 3, 3, 72, 8, 3, 3, 3, 74, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 3, 8, 89, 8, 8, 1, 8, 3, 8, 92, 8, 8, 1, 8, 3, 8, 95, 8, 8, 1, 9, 1, 9, 1, 9, 5, 9, 100, 8, 9, 10, 9, 12, 9, 103, 9, 9, 1, 10, 1, 10, 3, 10, 107, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 117, 8, 12, 10, 12, 12, 12, 120, 9, 12, 1, 13, 1, 13, 1, 13, 5, 13, 125, 8, 13, 10, 13, 12, 13, 128, 9, 13, 1, 14, 1, 14, 1, 14, 0, 0, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 0, 3, 2, 0, 4, 4, 15, 15, 2, 0, 14, 16, 18, 18, 2, 0, 17, 17, 19, 19, 137, 0, 31, 1, 0, 0, 0, 2, 39, 1, 0, 0, 0, 4, 48, 1, 0, 0, 0, 6, 73, 1, 0, 0, 0, 8, 75, 1, 0, 0, 0, 10, 78, 1, 0, 0, 0, 12, 81, 1, 0, 0, 0, 14, 84, 1, 0, 0, 0, 16, 88, 1, 0, 0, 0, 18, 96, 1, 0, 0, 0, 20, 104, 1, 0, 0, 0, 22, 108, 1, 0, 0, 0, 24, 112, 1, 0, 0, 0, 26, 121, 1, 0, 0, 0, 28, 129, 1, 0, 0, 0, 30, 32, 3, 28, 14, 0, 31, 30, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0, 32, 34, 1, 0, 0, 0, 33, 35, 3, 2, 1, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 36, 1, 0, 0, 0, 36, 37, 3, 6, 3, 0, 37, 38, 5, 0, 0, 1, 38, 1, 1, 0, 0, 0, 39, 43, 5, 1, 0, 0, 40, 41, 3, 4, 2, 0, 41, 42, 5, 2, 0, 0, 42, 44, 1, 0, 0, 0, 43, 40, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 46, 3, 4, 2, 0, 46, 47, 5, 3, 0, 0, 47, 3, 1, 0, 0, 0, 48, 49, 7, 0, 0, 0, 49, 5, 1, 0, 0, 0, 50, 53, 3, 8, 4, 0, 51, 53, 3, 10, 5, 0, 52, 50, 1, 0, 0, 0, 52, 51, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 55, 1, 0, 0, 0, 54, 56, 3, 12, 6, 0, 55, 54, 1, 0, 0, 0, 55, 56, 1, 0, 0, 0, 56, 58, 1, 0, 0, 0, 57, 59, 3, 14, 7, 0, 58, 57, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 74, 1, 0, 0, 0, 60, 62, 3, 12, 6, 0, 61, 60, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 65, 1, 0, 0, 0, 63, 66, 3, 8, 4, 0, 64, 66, 3, 10, 5, 0, 65, 63, 1, 0, 0, 0, 65, 64, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 68, 1, 0, 0, 0, 67, 69, 3, 14, 7, 0, 68, 67, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 74, 1, 0, 0, 0, 70, 72, 3, 16, 8, 0, 71, 70, 1, 0, 0, 0, 71, 72, 1, 0, 0, 0, 72, 74, 1, 0, 0, 0, 73, 52, 1, 0, 0, 0, 73, 61, 1, 0, 0, 0, 73, 71, 1, 0, 0, 0, 74, 7, 1, 0, 0, 0, 75, 76, 5, 5, 0, 0, 76, 77, 3, 26, 13, 0, 77, 9, 1, 0, 0, 0, 78, 79, 5, 6, 0, 0, 79, 80, 3, 26, 13, 0, 80, 11, 1, 0, 0, 0, 81, 82, 5, 7, 0, 0, 82, 83, 3, 26, 13, 0, 83, 13, 1, 0, 0, 0, 84, 85, 5, 8, 0, 0, 85, 86, 7, 1, 0, 0, 86, 15, 1, 0, 0, 0, 87, 89, 3, 18, 9, 0, 88, 87, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 91, 1, 0, 0, 0, 90, 92, 3, 22, 11, 0, 91, 90, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 94, 1, 0, 0, 0, 93, 95, 3, 24, 12, 0, 94, 93, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 17, 1, 0, 0, 0, 96, 101, 3, 20, 10, 0, 97, 98, 5, 9, 0, 0, 98, 100, 3, 20, 10, 0, 99, 97, 1, 0, 0, 0, 100, 103, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 19, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 104, 106, 3, 28, 14, 0, 105, 107, 3, 12, 6, 0, 106, 105, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 21, 1, 0, 0, 0, 108, 109, 5, 1, 0, 0, 109, 110, 3, 14, 7, 0, 110, 111, 5, 3, 0, 0, 111, 23, 1, 0, 0, 0, 112, 113, 5, 10, 0, 0, 113, 118, 3, 26, 13, 0, 114, 115, 5, 11, 0, 0, 115, 117, 3, 26, 13, 0, 116, 114, 1, 0, 0, 0, 117, 120, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 118, 119, 1, 0, 0, 0, 119, 25, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 121, 126, 3, 28, 14, 0, 122, 123, 5, 12, 0, 0, 123, 125, 3, 28, 14, 0, 124, 122, 1, 0, 0, 0, 125, 128, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 126, 127, 1, 0, 0, 0, 127, 27, 1, 0, 0, 0, 128, 126, 1, 0, 0, 0, 129, 130, 7, 2, 0, 0, 130, 29, 1, 0, 0, 0, 18, 31, 34, 43, 52, 55, 58, 61, 65, 68, 71, 73, 88, 91, 94, 101, 106, 118, 126]
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ public class DirectEditBaseListener implements DirectEditListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTriggerExpression(DirectEditParser.TriggerExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTriggerExpressionName(DirectEditParser.TriggerExpressionNameContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTriggerExpressionName(DirectEditParser.TriggerExpressionNameContext ctx) { }
/**
* {@inheritDoc}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ public interface DirectEditListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitTriggerExpression(DirectEditParser.TriggerExpressionContext ctx);
/**
* Enter a parse tree produced by {@link DirectEditParser#triggerExpressionName}.
* @param ctx the parse tree
*/
void enterTriggerExpressionName(DirectEditParser.TriggerExpressionNameContext ctx);
/**
* Exit a parse tree produced by {@link DirectEditParser#triggerExpressionName}.
* @param ctx the parse tree
*/
void exitTriggerExpressionName(DirectEditParser.TriggerExpressionNameContext ctx);
/**
* Enter a parse tree produced by {@link DirectEditParser#guardExpression}.
* @param ctx the parse tree
Expand Down
Loading

0 comments on commit 69960a0

Please sign in to comment.