Closed seidewitz closed 2 years ago
As part of this pull request, the following abstract syntax model corrections were made in SysML.uml
:
Relationship::relatedElement
- made not union (still derived)Association::relatedType
- made not union (still derived)Connector::relatedFeature
- made not union (still derived)Function::expression
- changed from redefinition to subsetFeatureValue::featureWithValue
- made derivedStakeholderMembership::ownedStakeholderParameter
- changed from subset to redefinitionI ran the SysMLInteractiveParsingProfiler
on the 2022-06 release, and, for comparison, on the head of this branch. The results indicate that there is some performance degradation, which is not entirely surprising. For parsing and validating a large model, the time seemingly can be up to about 30% longer (e.g., 43 seconds vs. 34 seconds). This is a bit unfortunately, but probably still acceptable.
This pull request moves the implementation of derived properties from non-generated in-line method code in metamodel
Impl
classes to separate delegate classes using the Eclipse "setting delegate" mechanism (as described here).Custom UML Importer
org.omg.sysml.uml.ecore.importer.CustomUMLImporter
class is a customization of theUMLImporter
class from the Eclipse UML2 project, which is used to load theSysML.uml
file into theSysML.genmodel
, generating athecorrespondingSysML.ecore
file. This class has been updated to add anECore
annotation to thesysml
Epackage inSysML.ecore
, withsettingDelegates->http://www.omg.org/spec/SysML
. This declareshttp://www.omg.org/spec/SysML
to be the annotation to be used on structural features to be delegated.CustomUML2EcoreConverter
class is a customization of theUML2EcoreConverter
from the Eclipse UML2 project, used by theCustomUMLImporter
to actually convert the content ofSysML.uml
into the content ofSysML.ecore
. This class as been updated to add ahttp://www.omg.org/spec/SysML
annotation to a structural feature in the Ecore file if one of the following conditions holds:SysML.ecore
that is not annotated as aunion
and is not a containment property is annotated for delegation.Setting Delegates
org.omg.sysml.delegate.DerivedPropertySettingDelegateFactory
, which is registered in theMANIFEST.MF
file fororg.omg.sysml
. The setting delegate for a given structural feature is instantiated using reflection, based on the name of setting delegate class, which must have the formContainingClassName
_structuralFeatureName
_SettingDelegate
. If no such class exists in the same package as the factory, then theDefaultDerivedPropertySettingDelegate
is instantiated instead.DefaultDerivedPropertySettingDelegate
can be used for a derived structural for which the following are all true:BasicDerivedPropertySettingDelegate
. This abstract class extends the EclipseBasicSettingDelegate.Stateless
class and implements theget
andisSet
methods using the abstractbasicGet
method. It is directly extended for properties with UML primitive types, overriding the abstractbasicGet
operation to implement the derivation computation.BasicDerivedObjectSettingDelegate
. This abstract class extendsBasicDerivedPropertySettingDelegate
, specializing the type ofbasicGet
toEObject
and overridingget
to provide proxy object resolution if requested. It is used as the base class for setting delegates that implement derivations that result in a non-collection object of a non-primitive type.BasicDerivedListSettingDelegate
. This abstract class extendsBasicDerivedPropertySettingDelegate
, specializing the type ofbasicGet
toEList<?>
and overridingisSet
to check for an empty list. It is used as the base class for setting delegates that implement derivations resulting in a list object.Impl
Classes@generated NOT
, since they contained in-line handwritten code for the derivation computations. TheNOT
has now been removed from the annotation for these methods, so they are automatically generated as calling to the appropriate setting delegate object.@generated NOT
in order to implement workarounds for limitations on what parse-tree actions can be specified in an Xtext grammar. Comments have been added to described the functioning of the workaround code.@generated NOT
and implemented in-line. (The intent is to eventually re-implement these methods using "operation invocation delegates".)