Class ContentLoopExpression

    • Constructor Detail

      • ContentLoopExpression

        public ContentLoopExpression​(VariableDeclaration iterator,
                                     Expression init,
                                     Expression separator,
                                     Expression endSeparator,
                                     java.util.List<Expression> body)
                              throws VilException
        Creates a content loop expression.
        Parameters:
        iterator - the iterator
        init - the initialization expression (shall/cannot be assigned to iterator as collection)
        separator - the optional element separator (may be null)
        endSeparator - the optional end separator (may be null)
        body - the loop body
        Throws:
        VilException - if creation fails
    • Method Detail

      • assertSeparatorEx

        private void assertSeparatorEx​(Expression ex,
                                       java.lang.String text)
                                throws VilException
        Asserts that a separator expression evaluates to a String.
        Parameters:
        ex - the expression, may be null (ignored then)
        text - text prefix if type assertion fails
        Throws:
        VilException - in case that obtaining the type fails
      • getIterator

        public VariableDeclaration getIterator()
        Returns the iterator declaration.
        Returns:
        the iterator declaration
      • getInit

        public Expression getInit()
        Returns the initialization expression.
        Returns:
        the initialization expression
      • getSeparator

        public Expression getSeparator()
        Returns the optional separator expression.
        Returns:
        the expression or null
      • getEndSeparator

        public Expression getEndSeparator()
        Returns the optional end separator expression.
        Returns:
        the expression or null
      • getExpressionsCount

        public int getExpressionsCount()
        Returns the number of body expression.
        Specified by:
        getExpressionsCount in interface IExpressionIterator
        Returns:
        the number of expressions
      • getExpression

        public Expression getExpression​(int index)
        Returns the specified body expression.
        Specified by:
        getExpression in interface IExpressionIterator
        Parameters:
        index - the 0-based index of the expression
        Returns:
        the expression
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=#getBodyExpressionsCount()
      • accept

        public java.lang.Object accept​(IExpressionVisitor visitor)
                                throws VilException
        Description copied from class: Expression
        Visits the expression.
        Specified by:
        accept in class Expression
        Parameters:
        visitor - the visitor
        Returns:
        the result of visiting this expression (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)