Class ContentAlternativeExpression
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.Expression
-
- net.ssehub.easy.instantiation.core.model.templateModel.InContentExpression
-
- net.ssehub.easy.instantiation.core.model.templateModel.ContentAlternativeExpression
-
public class ContentAlternativeExpression extends InContentExpression
Implements a content alternative expression.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private Expressionconditionprivate java.util.List<Expression>elseExprivate java.util.List<Expression>thenEx
-
Constructor Summary
Constructors Constructor Description ContentAlternativeExpression(Expression condition, java.util.List<Expression> thenEx, java.util.List<Expression> elseEx)Creates a content alternative expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(IExpressionVisitor visitor)Visits the expression.IExpressionIteratorelseEx()Returns an expression iterator over else expressions.ExpressiongetCondition()Returns the condition.ExpressiongetElseExpression(int index)Returns the specified then expression.intgetElseExpressionsCount()Returns the number of else expression.ExpressiongetThenExpression(int index)Returns the specified then expression.intgetThenExpressionsCount()Returns the number of then expression.IExpressionIteratorthenEx()Returns an expression iterator over then expressions.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.templateModel.InContentExpression
inferType, replaceEmptyLine
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.Expression
getFormattingHint
-
-
-
-
Field Detail
-
condition
private Expression condition
-
thenEx
private java.util.List<Expression> thenEx
-
elseEx
private java.util.List<Expression> elseEx
-
-
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 alternativethenEx- the then expressionselseEx- 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- ifindex<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- ifindex<0 || index>=getThenExpressionsCount()
-
accept
public java.lang.Object accept(IExpressionVisitor visitor) throws VilException
Description copied from class:ExpressionVisits the expression.- Specified by:
acceptin classExpression- Parameters:
visitor- the visitor- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
-