Class AlternativeExpression
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.Expression
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.AlternativeExpression
-
public class AlternativeExpression extends Expression
Represents a VIL alternative.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private Expressionconditionprivate IRuleBlockelsePartprivate IRuleBlockifPartprivate TypeDescriptor<?>type
-
Constructor Summary
Constructors Constructor Description AlternativeExpression()Constructor for serialization.AlternativeExpression(Expression condition, IRuleBlock ifPart, IRuleBlock elsePart)Creates an alternative expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(IExpressionVisitor visitor)Visits the expression.ExpressiongetCondition()Returns the condition to be evaluated.IRuleBlockgetElsePart()Returns the else-part to be executed if the condition is false.IRuleBlockgetIfPart()Returns the if-part to be executed if the condition is false.TypeDescriptor<?>inferType()Infers the type of this expression including the type of the contained sub-expressions.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.Expression
replaceEmptyLine
-
-
-
-
Field Detail
-
condition
private Expression condition
-
ifPart
private IRuleBlock ifPart
-
elsePart
private IRuleBlock elsePart
-
type
private TypeDescriptor<?> type
-
-
Constructor Detail
-
AlternativeExpression
AlternativeExpression()
Constructor for serialization.
-
AlternativeExpression
public AlternativeExpression(Expression condition, IRuleBlock ifPart, IRuleBlock elsePart) throws VilException
Creates an alternative expression.- Parameters:
condition- the condition to be evaluatedifPart- the if-part to be executed if the alternative is trueelsePart- the optional else-part to be executed if the alternative is false- Throws:
VilException- in case of syntactic or semantic problems
-
-
Method Detail
-
getCondition
public Expression getCondition()
Returns the condition to be evaluated.- Returns:
- the condition
-
getIfPart
public IRuleBlock getIfPart()
Returns the if-part to be executed if the condition is false.- Returns:
- the if-part
-
getElsePart
public IRuleBlock getElsePart()
Returns the else-part to be executed if the condition is false.- Returns:
- the else-part
-
inferType
public TypeDescriptor<?> inferType() throws VilException
Description copied from class:ExpressionInfers the type of this expression including the type of the contained sub-expressions.- Specified by:
inferTypein classExpression- Returns:
- the type of this expression
- Throws:
VilException- in case that inferring the type fails
-
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)
-
-