Class ContentAlternativeExpression


  • public class ContentAlternativeExpression
    extends InContentExpression
    Implements a content alternative expression.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • ContentAlternativeExpression

        public ContentAlternativeExpression​(Expression condition,
                                            java.util.List<Expression> thenEx,
                                            java.util.List<Expression> elseEx)
                                     throws VilException
        Creates a content alternative expression.
        Parameters:
        condition - the condition of the alternative
        thenEx - the then expressions
        elseEx - the optional else expressions (may be null)
        Throws:
        VilException - if creation fails
    • Method Detail

      • getCondition

        public Expression getCondition()
        Returns the condition.
        Returns:
        the condition
      • thenEx

        public IExpressionIterator thenEx()
        Returns an expression iterator over then expressions.
        Returns:
        the expression iterator
      • elseEx

        public IExpressionIterator elseEx()
        Returns an expression iterator over else expressions.
        Returns:
        the expression iterator
      • getThenExpressionsCount

        public int getThenExpressionsCount()
        Returns the number of then expression.
        Returns:
        the number of expressions
      • getElseExpressionsCount

        public int getElseExpressionsCount()
        Returns the number of else expression.
        Returns:
        the number of expressions
      • getThenExpression

        public Expression getThenExpression​(int index)
        Returns the specified then expression.
        Parameters:
        index - the 0-based index of the expression
        Returns:
        the expression
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getThenExpressionsCount()
      • getElseExpression

        public Expression getElseExpression​(int index)
        Returns the specified then expression.
        Parameters:
        index - the 0-based index of the expression
        Returns:
        the expression
        Throws:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getThenExpressionsCount()
      • 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)