use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class ExpressionsTypeInferrer method doInfer.
public InferenceResult doInfer(TypeSpecifier specifier) {
if (specifier.getType() instanceof GenericElement && ((GenericElement) specifier.getType()).getTypeParameters().size() > 0) {
List<InferenceResult> bindings = new ArrayList<>();
EList<TypeSpecifier> arguments = specifier.getTypeArguments();
for (TypeSpecifier typeSpecifier : arguments) {
InferenceResult binding = inferTypeDispatch(typeSpecifier);
if (binding != null) {
bindings.add(binding);
}
}
Type type = inferTypeDispatch(specifier.getType()).getType();
return InferenceResult.from(type, bindings);
}
return inferTypeDispatch(specifier.getType());
}
use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class TypeCastExpressionImpl method setType.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(Type newType) {
Type oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.TYPE_CAST_EXPRESSION__TYPE, oldType, type));
}
use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class OperationOverloadingResolver method isCallable.
protected boolean isCallable(Operation operation, ArgumentExpression expression) {
EList<Expression> orderedExpressions = ArgumentSorter.getOrderedExpressions(expression.getArguments(), operation);
List<Type> argumentTypes = orderedExpressions.stream().map(it -> inferrer.infer(it).getType()).filter(t -> t != null).collect(Collectors.toList());
List<Type> parameterTypes = operation.getParameters().stream().map(it -> it.getType()).collect(Collectors.toList());
if (argumentTypes.size() != parameterTypes.size())
return false;
for (int i = 0; i < argumentTypes.size(); i++) {
Type type1 = argumentTypes.get(i);
Type type2 = parameterTypes.get(i);
if (!typeSystem.isSuperType(type2, type1))
return false;
}
return true;
}
use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class ExpressionsJavaValidator method checkIsRaw.
@Check
public void checkIsRaw(TypeSpecifier typedElement) {
Type type = typedElement.getType();
if (!(type instanceof GenericElement))
return;
EList<TypeParameter> typeParameter = ((GenericElement) type).getTypeParameters();
if (typedElement.getTypeArguments().size() == 0 && typeParameter.size() > 0) {
String s1 = typedElement.getType().getName();
String s2 = s1 + printer.concatTypeParameter(typeParameter);
warning(String.format(WARNING_IS_RAW_MSG, s1, s2), typedElement, TypesPackage.Literals.TYPE_SPECIFIER__TYPE, WARNING_IS_RAW_CODE);
}
}
use of org.yakindu.base.types.Type in project statecharts by Yakindu.
the class OperationItemProvider method getTypeName.
protected String getTypeName(TypeSpecifier typeSpecifier) {
Type type = (Type) typeSpecifier.eGet(TypesPackage.Literals.TYPE_SPECIFIER__TYPE, false);
String typeName = "";
if (type == null) {
typeName = "null";
} else if (type.eIsProxy()) {
URI eProxyURI = ((InternalEObject) type).eProxyURI();
typeName = StringUtils.substringAfterLast(eProxyURI.fragment(), ".");
} else {
typeName = type.getName();
}
return typeName;
}
Aggregations