Search in sources :

Example 1 with TypeSpecifier

use of org.yakindu.base.types.TypeSpecifier 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());
}
Also used : EnumerationType(org.yakindu.base.types.EnumerationType) Type(org.yakindu.base.types.Type) ArrayList(java.util.ArrayList) TypeSpecifier(org.yakindu.base.types.TypeSpecifier) GenericElement(org.yakindu.base.types.GenericElement)

Example 2 with TypeSpecifier

use of org.yakindu.base.types.TypeSpecifier in project statecharts by Yakindu.

the class TypeAliasImpl method basicSetTypeSpecifier.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetTypeSpecifier(TypeSpecifier newTypeSpecifier, NotificationChain msgs) {
    TypeSpecifier oldTypeSpecifier = typeSpecifier;
    typeSpecifier = newTypeSpecifier;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypesPackage.TYPE_ALIAS__TYPE_SPECIFIER, oldTypeSpecifier, newTypeSpecifier);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TypeSpecifier(org.yakindu.base.types.TypeSpecifier)

Example 3 with TypeSpecifier

use of org.yakindu.base.types.TypeSpecifier in project statecharts by Yakindu.

the class StextTestFactory method _createVariableDefinition.

public static VariableDefinition _createVariableDefinition(String name, Type type, Scope scope) {
    VariableDefinition v = StextFactory.eINSTANCE.createVariableDefinition();
    v.setName(name);
    TypeSpecifier typeSpecifier = TypesFactory.eINSTANCE.createTypeSpecifier();
    typeSpecifier.setType(type);
    v.setTypeSpecifier(typeSpecifier);
    if (scope != null)
        scope.getDeclarations().add(v);
    return v;
}
Also used : VariableDefinition(org.yakindu.sct.model.stext.stext.VariableDefinition) TypeSpecifier(org.yakindu.base.types.TypeSpecifier)

Example 4 with TypeSpecifier

use of org.yakindu.base.types.TypeSpecifier in project statecharts by Yakindu.

the class ParameterImpl method basicSetTypeSpecifier.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetTypeSpecifier(TypeSpecifier newTypeSpecifier, NotificationChain msgs) {
    TypeSpecifier oldTypeSpecifier = typeSpecifier;
    typeSpecifier = newTypeSpecifier;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypesPackage.PARAMETER__TYPE_SPECIFIER, oldTypeSpecifier, newTypeSpecifier);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TypeSpecifier(org.yakindu.base.types.TypeSpecifier)

Example 5 with TypeSpecifier

use of org.yakindu.base.types.TypeSpecifier in project statecharts by Yakindu.

the class DeclarationImpl method basicSetTypeSpecifier.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetTypeSpecifier(TypeSpecifier newTypeSpecifier, NotificationChain msgs) {
    TypeSpecifier oldTypeSpecifier = typeSpecifier;
    typeSpecifier = newTypeSpecifier;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypesPackage.DECLARATION__TYPE_SPECIFIER, oldTypeSpecifier, newTypeSpecifier);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TypeSpecifier(org.yakindu.base.types.TypeSpecifier)

Aggregations

TypeSpecifier (org.yakindu.base.types.TypeSpecifier)5 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)3 ArrayList (java.util.ArrayList)1 EnumerationType (org.yakindu.base.types.EnumerationType)1 GenericElement (org.yakindu.base.types.GenericElement)1 Type (org.yakindu.base.types.Type)1 VariableDefinition (org.yakindu.sct.model.stext.stext.VariableDefinition)1