Class ExpressionTranslator

  • All Implemented Interfaces:
    IMessageReceiver

    public class ExpressionTranslator
    extends ExpressionTranslator
    Implements a class which translates a given EMF expression in terms of the IVML grammar into the IVML object model. Please note that errors which occur during translation are not signaled as individual exceptions but collected and accessible through ExpressionTranslator.getMessage(int).
    Author:
    Holger Eichelberger
    • Field Detail

      • level

        private int level
      • hasTopLevelWarning

        private boolean hasTopLevelWarning
    • Constructor Detail

      • ExpressionTranslator

        public ExpressionTranslator()
        Creates an expression translator (to be used within this package only).
    • Method Detail

      • initLevel

        void initLevel()
        Initializes the levels.
      • errorAboutTopLevelWarning

        void errorAboutTopLevelWarning​(org.eclipse.emf.ecore.EObject cause,
                                       org.eclipse.emf.ecore.EStructuralFeature causingFeature)
        Checks for illegal top-level warnings and emits an error if required.
        Parameters:
        cause - the causing EObject
        causingFeature - the causing feature
      • error

        void error​(IIdentifiable exception,
                   org.eclipse.emf.ecore.EObject cause,
                   org.eclipse.emf.ecore.EStructuralFeature causeFeature)
        Turns an IVML exception into a xText error.
        Parameters:
        exception - the exception to used
        cause - the cause (as instance of the EMF grammar model)
        causeFeature - the cause of the feature as an appropriate constant from IvmlPackage.Literals
      • warning

        void warning​(IvmlException exception,
                     org.eclipse.emf.ecore.EObject cause,
                     org.eclipse.emf.ecore.EStructuralFeature causeFeature)
        Turns an IVML exception into a xText warning.
        Parameters:
        exception - the exception to used
        cause - the cause (as instance of the EMF grammar model)
        causeFeature - the cause of the feature as an appropriate constant from IvmlPackage.Literals
      • handleBasicComment

        private ConstraintSyntaxTree handleBasicComment​(org.eclipse.emf.ecore.EObject object,
                                                        ConstraintSyntaxTree subtree)
        Handles the comments assigned to the EMF AST element object and inserts a comment node as top of the subtree if required.
        Parameters:
        object - the EMF AST element to analyze
        subtree - the constraint subtree to add the comment before
        Returns:
        the resulting subtree
      • processExpression

        public ConstraintSyntaxTree processExpression​(de.uni_hildesheim.sse.ivml.Expression expr,
                                                      TypeContext context,
                                                      IModelElement parent)
                                               throws TranslatorException
        Processes an expression and returns the result as a syntax tree. Calls initLevel(), i.e., do not call from inside.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processBlockExpression

        ConstraintSyntaxTree processBlockExpression​(de.uni_hildesheim.sse.ivml.BlockExpression block,
                                                    TypeContext context,
                                                    IModelElement parent)
                                             throws TranslatorException
        Processes a block expression.
        Parameters:
        block - the block
        context - the type context
        parent - the parent element
        Returns:
        the created constraint syntax tree
        Throws:
        TranslatorException - in case that the processing of the block must be terminated abnormally
      • processExpression

        private ConstraintSyntaxTree processExpression​(IDatatype lhsType,
                                                       de.uni_hildesheim.sse.ivml.OptBlockExpression expr,
                                                       TypeContext context,
                                                       IModelElement parent)
                                                throws TranslatorException
        Processes an (optional block) expression.
        Parameters:
        lhsType - the data type on the left hand side of the expression
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processExpression

        ConstraintSyntaxTree processExpression​(IDatatype lhsType,
                                               de.uni_hildesheim.sse.ivml.Expression expr,
                                               TypeContext context,
                                               IModelElement parent)
                                        throws TranslatorException
        Processes an expression and returns the result as a syntax tree. Call initLevel() if called from outside.
        Parameters:
        lhsType - the data type on the left hand side of the expression
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processAssignmentExpression

        private ConstraintSyntaxTree processAssignmentExpression​(de.uni_hildesheim.sse.ivml.AssignmentExpression expr,
                                                                 TypeContext context,
                                                                 IModelElement parent)
                                                          throws TranslatorException
        Process an assignment expression and turn it into a feature call.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • checkForSameTypeWarning

        private void checkForSameTypeWarning​(ConstraintSyntaxTree lhs,
                                             java.lang.String op,
                                             ConstraintSyntaxTree rhs,
                                             org.eclipse.emf.ecore.EObject cause,
                                             org.eclipse.emf.ecore.EStructuralFeature feature)
        Checks whether the operation op may return wrong results if types on both sides are not somehow assignable.
        Parameters:
        lhs - the left hand side expression
        op - the operator
        rhs - the right hand side expression
        cause - the causing grammar object
        feature - the causing grammar feature
      • inferDatatypeQuietly

        private IDatatype inferDatatypeQuietly​(ConstraintSyntaxTree cst)
        Infers the datatype of cst.
        Parameters:
        cst - the constraint syntax tree
        Returns:
        the inferred datatype or null in case of failures
      • processImplicationExpression

        private ConstraintSyntaxTree processImplicationExpression​(de.uni_hildesheim.sse.ivml.ImplicationExpression expr,
                                                                  TypeContext context,
                                                                  IModelElement parent)
                                                           throws TranslatorException
        Process an implication expression and turn it into a feature call.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • checkForAssigment

        private void checkForAssigment​(ConstraintSyntaxTree cst,
                                       boolean error,
                                       org.eclipse.emf.ecore.EObject cause,
                                       org.eclipse.emf.ecore.EStructuralFeature causingFeature)
        Checks for an assignment operation directly in cst and emits an error or a warning in case that the operation is found.
        Parameters:
        cst - the constraint syntax tree to be checked
        error - emit an error or a warning
        cause - the causing EObject
        causingFeature - the causing feature in cause
      • processLogicalExpression

        ConstraintSyntaxTree processLogicalExpression​(de.uni_hildesheim.sse.ivml.LogicalExpression expr,
                                                      TypeContext context,
                                                      IModelElement parent)
                                               throws TranslatorException
        Process a logical expression and turn it into a feature call. If called from outside, call initLevel() before.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processEqualityExpression

        private ConstraintSyntaxTree processEqualityExpression​(de.uni_hildesheim.sse.ivml.EqualityExpression expr,
                                                               TypeContext context,
                                                               IModelElement parent)
                                                        throws TranslatorException
        Process a equality expression and turn it into a feature call.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processRelationalExpression

        private ConstraintSyntaxTree processRelationalExpression​(de.uni_hildesheim.sse.ivml.RelationalExpression expr,
                                                                 TypeContext context,
                                                                 IModelElement parent)
                                                          throws TranslatorException
        Process a relational expression and turn it into a feature call.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processAdditiveExpression

        private ConstraintSyntaxTree processAdditiveExpression​(de.uni_hildesheim.sse.ivml.AdditiveExpression expr,
                                                               TypeContext context,
                                                               IModelElement parent)
                                                        throws TranslatorException
        Process an additive expression and turn it into a feature call.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processMultiplicativeExpression

        private ConstraintSyntaxTree processMultiplicativeExpression​(de.uni_hildesheim.sse.ivml.MultiplicativeExpression expr,
                                                                     TypeContext context,
                                                                     IModelElement parent)
                                                              throws TranslatorException
        Process a multiplicative expression and turn it into a feature call.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processUnaryExpression

        private ConstraintSyntaxTree processUnaryExpression​(de.uni_hildesheim.sse.ivml.UnaryExpression expr,
                                                            TypeContext context,
                                                            IModelElement parent)
                                                     throws TranslatorException
        Process a unary expression and turn it into a feature call.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processFeatureCall

        private ConstraintSyntaxTree processFeatureCall​(ConstraintSyntaxTree lhs,
                                                        de.uni_hildesheim.sse.ivml.FeatureCall call,
                                                        TypeContext context,
                                                        IModelElement parent)
                                                 throws TranslatorException
        Processes a feature call. This method allows to work with an empty lhs in case of a "context less method call" such as max(1, 2) or with a given lhs, e.g. for s.size();
        Parameters:
        lhs - the operand expression (may be null as described above)
        call - the call to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the lhs must be terminated abnormally
      • processFeatureCallImpl

        private ConstraintSyntaxTree processFeatureCallImpl​(ConstraintSyntaxTree lhs,
                                                            de.uni_hildesheim.sse.ivml.ActualArgumentList call,
                                                            TypeContext context,
                                                            IModelElement parent,
                                                            boolean checkOclCompliance)
                                                     throws TranslatorException
        Processes a feature call. This method allows to work with an empty lhs in case of a "context less method call" such as max(1, 2) or with a given lhs, e.g. for s.size();
        Parameters:
        lhs - the operand expression (may be null as described above)
        call - the call to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        checkOclCompliance - check for OCL compliance of this call, i.e., -> vs .
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the lhs must be terminated abnormally
      • processArgument

        private ConstraintSyntaxTree processArgument​(IDatatype lhsType,
                                                     de.uni_hildesheim.sse.ivml.ActualArgument arg,
                                                     TypeContext context,
                                                     IModelElement parent)
                                              throws TranslatorException
        Process an argument and returns a (named) expression.
        Parameters:
        lhsType - the left hand side type (optional, may be null)
        arg - the argument expression
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the (named) expression
        Throws:
        TranslatorException - in case that the expression cannot be translated for some reason
      • checkForCompoundElement

        private void checkForCompoundElement​(Compound comp,
                                             java.lang.String name,
                                             de.uni_hildesheim.sse.ivml.ActualArgumentList call)
                                      throws TranslatorException
        Checks for an existing compound element name in comp and throws an exception if that element does not exist. This method is used to check whether a compound access overlaps with an operation name.
        Parameters:
        comp - the compound to check
        name - the name of the element
        call - the causing call
        Throws:
        TranslatorException - an exception in case that the element does not exist (and in this specific case clashes with an operation call of the same name
      • processDeclaration

        private void processDeclaration​(ConstraintSyntaxTree lhs,
                                        de.uni_hildesheim.sse.ivml.ContainerOp op,
                                        TypeContext context,
                                        IModelElement parent,
                                        de.uni_hildesheim.sse.ivml.Declaration declaration,
                                        java.util.List<DecisionVariableDeclaration> declarators)
                                 throws TranslatorException
        Processes a valid declaration.
        Parameters:
        lhs - the operand expression the container operation runs on
        op - the container operation
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        declaration - the declaration to be processed
        declarators - the declarators to be modified as a side effect
        Throws:
        TranslatorException - in case that the processing of the lhs must be terminated abnormally
      • processContainerOp

        private ConstraintSyntaxTree processContainerOp​(ConstraintSyntaxTree lhs,
                                                        de.uni_hildesheim.sse.ivml.ContainerOp op,
                                                        TypeContext context,
                                                        IModelElement parent)
                                                 throws TranslatorException
        Processes a container operation. Fallback resolution to usual operations for non-iterating container operations and fallback to unqualified iterator expressions.
        Parameters:
        lhs - the operand expression the container operation runs on
        op - the container operation
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the lhs must be terminated abnormally
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(java.util.List<de.uni_hildesheim.sse.ivml.ActualArgument> args,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given arguments.
        Parameters:
        args - the arguments
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.ImplicationExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.AssignmentExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.LogicalExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.EqualityExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.RelationalExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.AdditiveExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.MultiplicativeExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.UnaryExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.PostfixExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.PrimaryExpression ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.Literal ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • getAccessor

        private ConstraintSyntaxTree getAccessor​(de.uni_hildesheim.sse.ivml.Value ex,
                                                 DecisionVariableDeclaration decl)
        Extracts a compound accessor/slot name from the given expression.
        Parameters:
        ex - the expression
        decl - the binding declarator
        Returns:
        the accessor, may be null if there is none
      • processContainerOp

        private ConstraintSyntaxTree processContainerOp​(ConstraintSyntaxTree lhs,
                                                        de.uni_hildesheim.sse.ivml.ContainerOp op,
                                                        java.util.List<DecisionVariableDeclaration> declarators,
                                                        ConstraintSyntaxTree declEx,
                                                        TypeContext context,
                                                        IModelElement parent)
                                                 throws TranslatorException
        Processes a container operation.
        Parameters:
        lhs - the operand expression the container operation runs on
        op - the container operation
        declarators - explicit declarators overriding the information given in op
        declEx - explicit iterator expression overriding the information given in op
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the lhs must be terminated abnormally
      • checkOperationOclCompliance

        private void checkOperationOclCompliance​(Operation op,
                                                 org.eclipse.emf.ecore.EObject cause,
                                                 org.eclipse.emf.ecore.EStructuralFeature feature)
        Checks for OCL operation compliance and issues a warning if violated and compliance mode is enabled.
        Parameters:
        op - the operation
        cause - the causing ECore object
        feature - the causing ECore feature
      • processPostfixExpression

        private ConstraintSyntaxTree processPostfixExpression​(de.uni_hildesheim.sse.ivml.PostfixExpression expr,
                                                              TypeContext context,
                                                              IModelElement parent)
                                                       throws TranslatorException
        Process a postfix expression and turn it into a feature call.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • refType

        private static IDatatype refType​(IDatatype varType,
                                         TypeContext context)
        Obtains the reference type.
        Parameters:
        varType - the variable type
        context - the type context
        Returns:
        the reference type
      • processPrimaryExpression

        private ConstraintSyntaxTree processPrimaryExpression​(de.uni_hildesheim.sse.ivml.PrimaryExpression expr,
                                                              TypeContext context,
                                                              IModelElement parent)
                                                       throws TranslatorException
        Process a primary expression.
        Parameters:
        expr - the expression to be processed
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processCallsAndAccess

        private ConstraintSyntaxTree processCallsAndAccess​(ConstraintSyntaxTree lhs,
                                                           java.util.List<de.uni_hildesheim.sse.ivml.Call> calls,
                                                           de.uni_hildesheim.sse.ivml.ExpressionAccess access,
                                                           TypeContext context,
                                                           IModelElement parent)
                                                    throws TranslatorException
        Process a possible empty list of calls and a possible empty access expression.
        Parameters:
        lhs - the expression on the left hand side (processed so far)
        calls - a list of calls (may be null or empty)
        access - an optional access expression (may be null)
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • hasLiteral

        private boolean hasLiteral​(Enum eenum,
                                   java.lang.String name)
        Returns whether the given enumeration eenum defines a literal called name.
        Parameters:
        eenum - the enumeration to to search for
        name - the name of the literal
        Returns:
        true if there is a literal with the given name, false else
      • hasSlot

        private boolean hasSlot​(Compound comp,
                                java.lang.String name)
        Returns whether the given compound comp or its refined compounds contains a slot of name name.
        Parameters:
        comp - the compound to search for
        name - the name of the slot
        Returns:
        true if there is a slot with the given name, false else
      • processAccess

        private ConstraintSyntaxTree processAccess​(ConstraintSyntaxTree lhs,
                                                   de.uni_hildesheim.sse.ivml.ExpressionAccess access,
                                                   TypeContext context,
                                                   IModelElement parent)
                                            throws TranslatorException
        Process an access expression.
        Parameters:
        lhs - the expression on the left hand side (processed so far)
        access - an access expression
        context - the type context to be considered
        parent - the actual (intended) parent of the constraint to be created
        Returns:
        the expression as a parsed syntax tree
        Throws:
        TranslatorException - in case that the processing of the expr must be terminated abnormally
      • processContainerInitializer

        private ConstraintSyntaxTree processContainerInitializer​(IDatatype lhsType,
                                                                 org.eclipse.emf.ecore.EObject expr,
                                                                 de.uni_hildesheim.sse.ivml.ContainerInitializer initializer,
                                                                 TypeContext context,
                                                                 IModelElement parent)
                                                          throws TranslatorException,
                                                                 IvmlException
        Processes a container initializer.
        Parameters:
        lhsType - the left hand side which defines the type (part)
        expr - the containing primary expression
        initializer - the initializer
        context - the type context for resolving variables etc.
        parent - the parent element
        Returns:
        an expression representing the literal collection
        Throws:
        TranslatorException - in case that the processing of the initializer must be terminated abnormally
        IvmlException - in case that the processing terminates in IVML type resolution
      • translateToValues

        private java.lang.Object[] translateToValues​(java.lang.Object[] values)
                                              throws IvmlException
        Translates constant expression trees to constant values. This method is required since value objects shall not have constraint syntax tree values but store the values directly.
        Parameters:
        values - the values to be translated (to be modified as a side effect)
        Returns:
        the translated values
        Throws:
        IvmlException - in case that the expressions in value do not represent literals
      • getSpecificType

        private IDatatype getSpecificType​(IDatatype lhsType,
                                          de.uni_hildesheim.sse.ivml.ContainerInitializer initializer,
                                          TypeContext context)
                                   throws TranslatorException
        Returns the specific type of a collection initializer.
        Parameters:
        lhsType - the left hand side which defines the type (part)
        initializer - the initializer
        context - the type context for resolving variables etc.
        Returns:
        the specific type (may be null if there is none)
        Throws:
        TranslatorException - in case that the processing of the initializer must be terminated abnormally
      • processLiteralContainer

        private ConstraintSyntaxTree processLiteralContainer​(IDatatype lhsType,
                                                             de.uni_hildesheim.sse.ivml.ContainerInitializer initializer,
                                                             TypeContext context,
                                                             IModelElement parent)
                                                      throws TranslatorException,
                                                             CSTSemanticException,
                                                             IvmlException
        Processes a collection initializer and returns the related constraint syntax tree node.
        Parameters:
        lhsType - the left hand side which defines the type (part)
        initializer - the initializer
        context - the type context for resolving variables etc.
        parent - the parent element
        Returns:
        the related constraint syntax tree node
        Throws:
        TranslatorException - in case that the processing of the initializer must be terminated abnormally
        CSTSemanticException - in case that the processing of the initializer must be terminated abnormally
        IvmlException - in case that the processing of the initializer must be terminated abnormally
      • allConstant

        private static boolean allConstant​(ConstraintSyntaxTree[] exprs)
        Returns whether all exprs are constant.
        Parameters:
        exprs - the expressions to analyze
        Returns:
        true if all expressions are constant, false else
      • warnDiscouragedNames

        public void warnDiscouragedNames​(java.lang.String name,
                                         org.eclipse.emf.ecore.EObject cause,
                                         org.eclipse.emf.ecore.EStructuralFeature causingFeature)
        Checks for and warns about discouraged names.
        Parameters:
        name - the name to be checked
        cause - the causing language element
        causingFeature - the causing language feature