Skip to content

Commit

Permalink
Stability update in operation resolution #11
Browse files Browse the repository at this point in the history
  • Loading branch information
ujhelyiz committed Sep 12, 2015
1 parent 7428938 commit b4a65da
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import com.incquerylabs.uml.ralf.reducedAlfLanguage.StaticFeatureInvocationExpression;
import com.incquerylabs.uml.ralf.reducedAlfLanguage.Tuple;
import com.incquerylabs.uml.ralf.resource.ReducedAlfLanguageResource;
import com.incquerylabs.uml.ralf.types.IUMLTypeReference;

import it.xsemantics.runtime.Result;

public class ReducedAlfLanguageLinkingService extends DefaultLinkingService {

Expand All @@ -42,19 +45,22 @@ public List<EObject> getLinkedObjects(EObject context, EReference ref, INode nod
FeatureInvocationExpression featureInvocationExpression = (FeatureInvocationExpression) context;
Expression ctx = featureInvocationExpression.getContext();
parameters = featureInvocationExpression.getParameters();
contextType = typeSystem.type(ctx).getValue().getUmlType();
Result<IUMLTypeReference> type = typeSystem.type(ctx);
if (!type.failed()) {
contextType = type.getValue().getUmlType();
}
} else if (context.eContainer() instanceof StaticFeatureInvocationExpression) {
StaticFeatureInvocationExpression staticFeatureInvocationExpression = (StaticFeatureInvocationExpression) context.eContainer();
parameters = staticFeatureInvocationExpression.getParameters();
contextType = op.getClass_();
} else {
//throw new UnsupportedOperationException("Invalid context of Operation call: " + context.eClass().getName());
return linkedObjects;
}
candidates = umlContext.getOperationCandidatesOfClass((Classifier) contextType, op.getName());
if (candidates != null && candidates.size() > 1) {
linkedObjects = Lists.newArrayList(candidateChecker.calculateBestCandidates(candidates, parameters));
if (contextType != null && parameters != null) {
candidates = umlContext.getOperationCandidatesOfClass((Classifier) contextType, op.getName());
if (candidates != null && candidates.size() > 1) {
linkedObjects = Lists.newArrayList(candidateChecker.calculateBestCandidates(candidates, parameters));
}
}

}
return linkedObjects;
}
Expand Down

0 comments on commit b4a65da

Please sign in to comment.