2323
2424import org .omg .sysml .lang .sysml .Feature ;
2525import org .omg .sysml .lang .sysml .FeatureChainExpression ;
26+ import org .omg .sysml .lang .sysml .FeatureDirectionKind ;
2627import org .omg .sysml .lang .sysml .SysMLFactory ;
2728import org .omg .sysml .lang .sysml .SysMLPackage ;
2829import org .omg .sysml .util .FeatureUtil ;
@@ -42,19 +43,21 @@ public FeatureChainExpression getTarget() {
4243
4344 /**
4445 * @satisfies checkFeatureChainExpressionResultSpecialization
45- *
46- * TODO: Revise to explicitly get first "in" parameter, to more closely match OCL.
4746 */
4847 @ Override
4948 protected void addResultTyping () {
5049 FeatureChainExpression target = getTarget ();
5150 Feature result = target .getResult ();
5251 Feature sourceTarget = target .sourceTargetFeature ();
5352 if (result != null && sourceTarget != null ) {
54- Feature sourceParameter = TypeUtil .getOwnedParameterOf (target , 0 , Feature .class );
55- TypeUtil .addImplicitGeneralTypeTo (result ,
56- SysMLPackage .eINSTANCE .getSubsetting (),
57- FeatureUtil .chainFeatures (sourceParameter , sourceTarget ));
53+ Feature sourceParameter = target .getOwnedFeature ().stream ().
54+ filter (param ->param .getDirection () == FeatureDirectionKind .IN ).
55+ findFirst ().orElse (null );
56+ if (sourceParameter != null ) {
57+ TypeUtil .addImplicitGeneralTypeTo (result ,
58+ SysMLPackage .eINSTANCE .getSubsetting (),
59+ FeatureUtil .chainFeatures (sourceParameter , sourceTarget ));
60+ }
5861 }
5962 }
6063
0 commit comments