Skip to content

New EMV2 Instance#2740

Merged
lwrage merged 133 commits intomasterfrom
new-error-model-instance
Jun 5, 2022
Merged

New EMV2 Instance#2740
lwrage merged 133 commits intomasterfrom
new-error-model-instance

Conversation

@joeseibel
Copy link
Copy Markdown
Contributor

@joeseibel joeseibel commented Jan 12, 2022

Fixes #2802.

This is the updated pull request and branch for the error model instance. The old pull request can be found here: #2646.

This branch started with taking Peter's meta-model, instantiator, tests, and other supporting code and copying it to a new branch. Now that his code runs again, we can begin to evaluate his meta-model.

Here are some low level issues found with the meta-model:

  • The type EOperation is poorly named. A more meaningful name should be selected and especially one that does not conflict with a standard EMF type name.
  • Evaluate if the types ConstraintElement, ConstraintExpression, and ConstrainedInstanceObject are properly named.
  • StateMachineInstance has the field currentState. This seems to be similar to how SystemInstance keeps track of its current SOM. Peter's instantiator sets currentState to the current state, but there is no code that updates this field. Do we really want to handle state by mutating the model? Would it be better for an analysis or utility method to iterate and keep track of the current state rather than storing it in the model?
  • ConstrainedInstanceObject has the field instanceObject which points to an InstanceObject. The name of this field should be updated to be more descriptive. Also, the type should be more restrictive.
  • ConstrainedInstanceObject.propagationKind has the type EString. Can this be a better type such as an enum? I think this is supposed to be set when a propagation doesn't refer to a feature, but instead is marked as processor, memory, connection, etc. I think that the field is a string in the declarative because of Xtext restrictions, but the instantiator should be able to convert that to an enum.
  • For the type ConstrainedInstanceObject, it seems that either the field instanceObject should be set or the field propagationKind should be set. It seems like they will never both be set. If this is true, this restriction should be expressed in the meta-model.
  • What is the relationship between ConstrainedInstanceObject and ErrorPropagationInstance. Should these be one type or does the inheritance make sense? The field propagationKind is on ConstrainedInstanceObject, but it would seem that it should be on ErrorPropagationInstance, but it is never set when constructing an ErrorPropagationInstance.
  • StateTransitionInstance has the field stateTransition which points to an EObject. The type of this field should be more restrictive.
  • ErrorFlowInstance has the field emv2Element which points to a NamedElement. The name of this field should be updated to be more descriptive. Also, the type should be more restrictive.
  • ErrorFlowInstance has the fields source and sink, both of which are EBooleans. First of all, these fields are never used. It seems like the intention is that source will be true for flow sources, sink will be true for flow sinks, and both will be true for flow paths. There are so many alternatives which could be better such as an enum, checking the fields incoming and outgoing for null, or even creating the subtypes ErrorFlowSourceInstance, ErrorFlowSinkInstance, and ErrorFlowPathInstance.
  • ErrorPropagationConditionInstance has the field emv2Element. The name of this field should be updated to be more descriptive.
  • ErrorPropagationConditionInstance has the fields source and sink, both of which are EBooleans. I don't think these fields make any sense and they are probably a copy & paste error.
  • ErrorDetectionInstance has the field emv2Element. The name of this field should be updated to be more descriptive.
  • ErrorDetectionInstance has the field errorCode which points to an EString. In the declarative, this could be an integer, a string, or a property constant. I'm assuming that the property constant only makes sense when it points to an integer or a string. Currently when instantiating, Peter takes any integers and converts them to strings. Is this correct? Should we make a distinction between an integer and a string in the instance meta-model.
  • ConstraintExpression has the field k which is an ELong. This is only used when the operator is KORMORE. Should the operator really be an enum or should we have specific subtypes with only the fields that are needed?
  • PropagationPathInstance has the field emv2Element which points to a NamedElement. The name of this field should be updated to be more descriptive. Also, the type should be more restrictive.

EMV2Instance.ecore and EMV2Instance.genmodel were copied from Peter's old EMV2Instance branch.
The EMV2 instantiator also needed to be updated in order for the tests to pass.
This is done to allow generation of emv2 instance elements on the SystemInstance. Previously, these elements were not generated because SystemInstance.getClassifier() returns null.
These subtypes handle the separate cases when a propagation refers to a feature, refers to a propagation point, or has a binding reference.
Renamed FeatureReference, PointReference, and BindingReference to FeaturePropagation, PointPropagation, and BindingPropagation.
The purpose of this restructuring was to create a specific EClass to
represent the results of flattening out a type set. This EClass is
TypeTokenInstance which is the super type of TypeInstance and
TypeProductInstance. TypeSetElement becomes the new super type of
TypeTokenInstance and TypeSetInstance.

Also created AbstractTypeSet and AnonymousTypeSet. Propagations now
point to an AnonymousTypeSet instead of a list of elements. This was
done to have a single implementation of flatten in AbstractTypeSet.
@joeseibel joeseibel closed this May 17, 2022
@joeseibel joeseibel reopened this May 17, 2022
joeseibel added 7 commits May 18, 2022 11:47
This addresses a problem with test failures during the maven build that
did not occur when running the tests from within Eclipse. Since the
plugin org.osate.aadl2.errormodel.tests contains both JUnit 4 and 5
tests, this was causing FormatterTest and Issue2398Test to fail during
the maven build. Upgrading these two tests seems to have fixed the
issue.
@joeseibel joeseibel marked this pull request as ready for review May 19, 2022 20:50
@joeseibel joeseibel requested review from lwrage and sprocter May 19, 2022 20:51
@sprocter
Copy link
Copy Markdown
Contributor

Hi,

I'm not sure how to review this -- it "seemed" too large to me, and sure enough a quick google turned up "optimal sizes" of pull requests that are 2-3 orders of magnitude smaller than this one (see, eg, 1, 2, 3). Even granting that much of the 58,000sloc is generated, this is too large for my review.

Can it be restructured and split into multiple PRs? Or do you (@lwrage) want to waive my request?

@lwrage lwrage merged commit f7681da into master Jun 5, 2022
@joeseibel joeseibel deleted the new-error-model-instance branch June 7, 2022 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instantiate basic EMV2 elements Instantiate error model annex subclauses

3 participants