Class AlternativeStatement

    • Constructor Detail

      • AlternativeStatement

        AlternativeStatement()
        Constructor for serialization.
      • AlternativeStatement

        public AlternativeStatement​(Expression condition,
                                    ITemplateElement ifStatement)
                             throws VilException
        Create an alternative-statement with a single if-block only.
        Parameters:
        condition - The condition which must be evaluated to true to process the if-block.
        ifStatement - The if-statement which subsumes a set of template elements that will only be processed if the condition is evaluated to true.
        Throws:
        VilException - in case that the construction fails due to semantic problems
      • AlternativeStatement

        public AlternativeStatement​(Expression condition,
                                    ITemplateElement ifStatement,
                                    ITemplateElement elseStatement)
                             throws VilException
        Create an alternative-statement with an if-block and an else-block.
        Parameters:
        condition - The condition of this alternative. If evaluated to true the if-block will be processed. If evaluated to false the else-block will be processed.
        ifStatement - The if-block which subsumes a set of template elements that will only be processed if the condition is evaluated to true.
        elseStatement - The else-block which subsumes a set of template elements that will only be processed if the condition is evaluated to false.
        Throws:
        VilException - in case that the construction fails due to semantic problems
    • Method Detail

      • getCondition

        public Expression getCondition()
        Get the condition of this alternative.
        Returns:
        The condition expression of this alternative
      • getIfStatement

        public ITemplateElement getIfStatement()
        Get the if-statement of this alternative.
        Returns:
        The template element that represents the if-statement of this alternative.
      • getElseStatement

        public ITemplateElement getElseStatement()
        Get the else-statement of this alternative.
        Returns:
        The template element that represents the else-statement of this alternative or null if no else-statement is defined.
      • accept

        public java.lang.Object accept​(IVisitor visitor)
                                throws VilException
        Description copied from interface: ITemplateLangElement
        Accepts the visitor for visiting.
        Parameters:
        visitor - the visitor to be used
        Returns:
        the result of visiting this instance (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • isBlock

        public boolean isBlock()
        Description copied from interface: ITemplateElement
        Returns whether this element is a block (opposite is a single statement).
        Returns:
        true if it is a block, false else
      • endsWithContentStatement

        public boolean endsWithContentStatement()
        Description copied from interface: ITemplateElement
        Returns whether this element ends with a content statement.
        Returns:
        true for end with content statement, false else