use of org.yakindu.base.types.Operation in project statecharts by Yakindu.
the class AbstractTypeSystem method getOperationExtensions.
@Override
public List<Operation> getOperationExtensions(Type type) {
List<Operation> result = new ArrayList<>();
result.addAll(extensionOperationRegistry.get(type));
List<Type> superTypes = getSuperTypes(type);
for (Type superType : superTypes) {
result.addAll(extensionOperationRegistry.get(superType));
}
return result;
}
use of org.yakindu.base.types.Operation in project statecharts by Yakindu.
the class ExpressionsJavaValidator method checkOperationArguments_FeatureCall.
@Check(CheckType.FAST)
public void checkOperationArguments_FeatureCall(final FeatureCall call) {
if (call.getFeature() instanceof Operation) {
Operation operation = (Operation) call.getFeature();
assertOperationArguments(operation, call.getExpressions());
}
}
use of org.yakindu.base.types.Operation in project statecharts by Yakindu.
the class ExpressionsJavaValidator method checkOperationArguments_TypedElementReferenceExpression.
@Check(CheckType.FAST)
public void checkOperationArguments_TypedElementReferenceExpression(final ElementReferenceExpression call) {
if (call.getReference() instanceof Operation) {
Operation operation = (Operation) call.getReference();
assertOperationArguments(operation, call.getExpressions());
}
}
use of org.yakindu.base.types.Operation in project statecharts by Yakindu.
the class OperationOverloadingResolver method linkOperation.
public Optional<Operation> linkOperation(List<IEObjectDescription> candidates, ArgumentExpression call) {
if (candidates.size() == 1 && candidates.get(0).getEClass().isSuperTypeOf(TypesPackage.Literals.OPERATION)) {
return Optional.of((Operation) candidates.get(0).getEObjectOrProxy());
}
List<Operation> operations = candidates.stream().map(it -> (Operation) it.getEObjectOrProxy()).collect(Collectors.toList());
Collections.sort(operations, new PolymorphicComparator());
for (Operation operation : operations) {
if (isCallable(operation, call)) {
return Optional.of(operation);
}
}
return Optional.empty();
}
Aggregations