Class IvmlValidationVisitor

    • Field Detail

      • location

        private java.util.Stack<java.lang.String> location
      • customTypes

        private java.util.Set<IDatatype> customTypes
    • Constructor Detail

      • IvmlValidationVisitor

        public IvmlValidationVisitor()
    • Method Detail

      • getErrorCount

        public int getErrorCount()
        Returns the number of detected errors.
        Returns:
        the number of detected errors
      • getMessageCount

        public int getMessageCount()
        Returns the number of detected messages.
        Returns:
        the number of detected messages
      • getMessage

        public ValidationMessage getMessage​(int index)
        Returns the specified message.
        Parameters:
        index - the index of the message to return
        Returns:
        the message
        Throws:
        java.lang.IndexOutOfBoundsException - if index < 0 || index >=getMessageCount()}
      • checkNameIdentifier

        private void checkNameIdentifier​(java.lang.String identifier,
                                         java.lang.Object cause)
        Checks for a valid (name) identifier and stores an error message if required.
        Parameters:
        identifier - the identifier to check for
        cause - the cause for the error (may be null)
      • checkIdentifier

        private void checkIdentifier​(java.lang.String identifier,
                                     java.lang.String info,
                                     java.lang.Object cause,
                                     boolean allowWildcard)
        Checks for a valid identifier and stores an error message if required.
        Parameters:
        identifier - the identifier to check for
        info - optional information denoting the specific part with invalid identifier
        cause - the cause for the error (may be null)
        allowWildcard - allows for wildcard characters
      • checkType

        private void checkType​(IDatatype type,
                               java.lang.Object cause)
        Checks for a valid datatype.
        Parameters:
        type - the type to be checked
        cause - the cause for the error (may be null)
      • checkParent

        private void checkParent​(IModelElement element,
                                 IModelElement expectedParent)
        Checks for a valid parent (reference).
        Parameters:
        element - the element to check the parent reference for
        expectedParent - the expected parent reference
      • checkParent

        private void checkParent​(IModelElement parent,
                                 java.lang.Object cause,
                                 IModelElement expectedParent)
        Checks for a valid parent (reference).
        Parameters:
        parent - the parent reference for
        cause - the cause for the error (the holder of the parent reference)
        expectedParent - the expected parent reference
      • checkComment

        private void checkComment​(java.lang.String text,
                                  boolean allowNull,
                                  java.lang.Object cause)
        Checks a comment.
        Parameters:
        text - the comment text
        allowNull - if true then text==null is not considered as an error, if false an error is registered in case of text==null
        cause - the cause for the error (may be null)
      • checkExpression

        private boolean checkExpression​(ConstraintSyntaxTree expression,
                                        java.lang.String info,
                                        java.lang.Object cause)
        Checks for a valid (sub-)expression.
        Parameters:
        expression - the expression to check
        info - optional information denoting the specific expression
        cause - the cause for the error (may be null)
        Returns:
        true if the expression is valid, false else
      • addError

        private void addError​(java.lang.String text,
                              java.lang.Object cause,
                              int code)
        Adds an error and appends the current location if possible.
        Parameters:
        text - the textual description of the error
        cause - the cause for the error (may be null)
        code - specifies the kind of the error (ValidationMessage)
      • addElementIsNullError

        private void addElementIsNullError​(java.lang.String elementName,
                                           int pos,
                                           java.lang.Object cause)
        Adds an error because the given element is null.
        Parameters:
        elementName - the logical name of the element
        pos - the position within the element collection
        cause - the cause for the error (may be null)
      • visitProjectImport

        public void visitProjectImport​(ProjectImport pImport)
        Description copied from interface: IModelVisitor
        This method is used for visiting a ProjectImport.
        Specified by:
        visitProjectImport in interface IModelVisitor
        Parameters:
        pImport - One ProjectImport which should be visited.
      • visitAttribute

        public void visitAttribute​(Attribute attribute)
        Description copied from interface: IModelVisitor
        Method for visiting an attribute.
        Specified by:
        visitAttribute in interface IModelVisitor
        Parameters:
        attribute - The attribute which should be visited.
      • visitConstraint

        public void visitConstraint​(Constraint constraint)
        Description copied from interface: IModelVisitor
        Method for visiting a constraint.
        Specified by:
        visitConstraint in interface IModelVisitor
        Parameters:
        constraint - The constraint which should be visited.
      • visitFreezeBlock

        public void visitFreezeBlock​(FreezeBlock freeze)
        Description copied from interface: IModelVisitor
        Method for visiting a freeze block.
        Specified by:
        visitFreezeBlock in interface IModelVisitor
        Parameters:
        freeze - The freeze block which should be visited.
      • visitComment

        public void visitComment​(Comment comment)
        Description copied from interface: IModelVisitor
        Method for visiting a comment.
        Specified by:
        visitComment in interface IModelVisitor
        Parameters:
        comment - the comment to visit
      • visitConstraintValue

        public void visitConstraintValue​(ConstraintValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting ConstraintValue.
        Specified by:
        visitConstraintValue in interface IValueVisitor
        Parameters:
        value - One ConstraintValue which should be visited.
      • visitEnumValue

        public void visitEnumValue​(EnumValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting EnumValue.
        Specified by:
        visitEnumValue in interface IValueVisitor
        Parameters:
        value - One EnumValue which should be visited.
      • visitStringValue

        public void visitStringValue​(StringValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting StringValue.
        Specified by:
        visitStringValue in interface IValueVisitor
        Parameters:
        value - One StringValue which should be visited.
      • visitCompoundValue

        public void visitCompoundValue​(CompoundValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting CompoundValue.
        Specified by:
        visitCompoundValue in interface IValueVisitor
        Parameters:
        value - One CompoundValue which should be visited.
      • visitContainerValue

        public void visitContainerValue​(ContainerValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting ContainerValue.
        Specified by:
        visitContainerValue in interface IValueVisitor
        Parameters:
        value - One CompoundValue which should be visited.
      • visitIntValue

        public void visitIntValue​(IntValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting IntValue.
        Specified by:
        visitIntValue in interface IValueVisitor
        Parameters:
        value - One IntValue which should be visited.
      • visitRealValue

        public void visitRealValue​(RealValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting RealValue.
        Specified by:
        visitRealValue in interface IValueVisitor
        Parameters:
        value - One RealValue which should be visited.
      • visitBooleanValue

        public void visitBooleanValue​(BooleanValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting BooleanValue.
        Specified by:
        visitBooleanValue in interface IValueVisitor
        Parameters:
        value - One BooleanValue which should be visited.
      • visitReferenceValue

        public void visitReferenceValue​(ReferenceValue referenceValue)
        Description copied from interface: IValueVisitor
        This method is used for visiting referenceValue.
        Specified by:
        visitReferenceValue in interface IValueVisitor
        Parameters:
        referenceValue - One referenceValue which should be visited.
      • visitMetaTypeValue

        public void visitMetaTypeValue​(MetaTypeValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting meta type value.
        Specified by:
        visitMetaTypeValue in interface IValueVisitor
        Parameters:
        value - a value which should be visited.
      • visitVersionValue

        public void visitVersionValue​(VersionValue value)
        Description copied from interface: IValueVisitor
        This method is used for visiting a version value.
        Specified by:
        visitVersionValue in interface IValueVisitor
        Parameters:
        value - a value which should be visited.