-
Notifications
You must be signed in to change notification settings - Fork 71
[1998] Add Implicit TypeFeaturing #2000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ | |
| import org.eclipse.syson.sysml.Redefinition; | ||
| import org.eclipse.syson.sysml.ReferenceSubsetting; | ||
| import org.eclipse.syson.sysml.Subsetting; | ||
| import org.eclipse.syson.sysml.SysmlFactory; | ||
| import org.eclipse.syson.sysml.SysmlPackage; | ||
| import org.eclipse.syson.sysml.Type; | ||
| import org.eclipse.syson.sysml.TypeFeaturing; | ||
|
|
@@ -462,6 +463,13 @@ public EList<Type> getFeaturingType() { | |
| if (!chainingFeature.isEmpty()) { | ||
| featuringTypes.addAll(chainingFeature.get(0).getFeaturingType()); | ||
| } | ||
|
|
||
| // Add implicit featuring type | ||
| Type implicitType = this.computeImplicitFeaturingType(); | ||
| if (implicitType != null) { | ||
| featuringTypes.add(implicitType); | ||
| } | ||
|
|
||
| return new EcoreEList.UnmodifiableEList<>(this, SysmlPackage.eINSTANCE.getFeature_FeaturingType(), featuringTypes.size(), featuringTypes.toArray()); | ||
| } | ||
|
|
||
|
|
@@ -1539,4 +1547,35 @@ private Collection<Feature> collectTypingFeatures() { | |
| } | ||
| return featureCollector; | ||
| } | ||
|
|
||
| /** | ||
| * @generated NOT | ||
| */ | ||
| private Type computeImplicitFeaturingType() { | ||
| Type owningType = this.getOwningType(); | ||
| Type implicitType = null; | ||
| if (owningType != null) { | ||
|
|
||
| if (!this.isIsVariable()) { | ||
| // KerML 7.3.2.6 “Feature Membership” – “A feature that is declared within the body of a type … automatically has that type as a featuring type.” | ||
| implicitType = owningType; | ||
| } else { | ||
| // KerML 8.4.4.3 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment seems not related with the code below. |
||
| // Class (or any Type that directly or indirectly specializes Occurrence) may have ownedFeatures with | ||
| // isVariable = true. The checkFeatureFeatureMembershipTypeFeaturing constraint requires that such | ||
| // variable Features are featured by the snapshots of their owningType. | ||
| implicitType = SysmlFactory.eINSTANCE.createFeature(); | ||
| implicitType.setDeclaredName(owningType.getDeclaredName() + "-SNAPSHOT"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is "-SNAPSHOT" arbitrary suffix? If it is, could you please just mention it? |
||
|
|
||
| // This virtual type should at some point redefine Occurrences::Occurrence::snapshots | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And where it is done? (note @gcoutable is working on an issue that is related to |
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. useless empty line |
||
| TypeFeaturing typeFeaturing = SysmlFactory.eINSTANCE.createTypeFeaturing(); | ||
| typeFeaturing.setFeaturingType(owningType); | ||
| typeFeaturing.setFeatureOfType((Feature) implicitType); | ||
| implicitType.getOwnedRelationship().add(typeFeaturing); | ||
| } | ||
|
|
||
| } | ||
| return implicitType; | ||
| } | ||
| } // FeatureImpl | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,6 +65,14 @@ part system { | |
|
|
||
| ** `Req Id` and `Declared Short Name` properties of `RequirementDefinition` and `RequirementUsage` are now synchronized, as required by the SysMLv2 specification. | ||
|
|
||
| * In _Validation_ view: | ||
|
|
||
| ** Improve the computation to _featuringType_ on `Feature` to avoid getting the following validation error: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. computation to => computation of |
||
| + | ||
| ``` | ||
| If a Feature is owned via a FeatureMembership, then it must have a featuringType for which the operation isFeaturingType returns true. (checkFeatureFeatureMembershipTypeFeaturing constraint on Feature is not respected for Test::MyItemDef::myFeature) | ||
| ```` | ||
|
|
||
| == Improvements | ||
|
|
||
| * In diagrams: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing category (please add one each time, you regularly forget to add one)