Class CompositeExpression
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.Expression
-
- net.ssehub.easy.instantiation.core.model.expressions.CompositeExpression
-
- All Implemented Interfaces:
IExpressionIterator
public class CompositeExpression extends Expression implements IExpressionIterator
Represents a composite expression.- Author:
- Sass, Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Expression>expressionList
-
Constructor Summary
Constructors Constructor Description CompositeExpression()Constructor for serialization.CompositeExpression(java.util.List<Expression> expressionList)Creates a new composite expression.CompositeExpression(Expression... expressions)Creates a new composite expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(IExpressionVisitor visitor)Visits the expression.ExpressiongetExpression(int index)Returns the specified expression.intgetExpressionsCount()Returns the number of expression.TypeDescriptor<?>inferType()Infers the type of this expression including the type of the contained sub-expressions.voidsetExpression(int index, Expression expr)Replaces the specified expression.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.Expression
replaceEmptyLine
-
-
-
-
Field Detail
-
expressionList
private java.util.List<Expression> expressionList
-
-
Constructor Detail
-
CompositeExpression
CompositeExpression()
Constructor for serialization.
-
CompositeExpression
public CompositeExpression(java.util.List<Expression> expressionList)
Creates a new composite expression.- Parameters:
expressionList- a list with expressions
-
CompositeExpression
public CompositeExpression(Expression... expressions)
Creates a new composite expression.- Parameters:
expressions- the expressions
-
-
Method Detail
-
getExpressionsCount
public int getExpressionsCount()
Returns the number of expression.- Specified by:
getExpressionsCountin interfaceIExpressionIterator- Returns:
- the number of expressions
-
getExpression
public Expression getExpression(int index)
Returns the specified expression.- Specified by:
getExpressionin interfaceIExpressionIterator- Parameters:
index- the 0-based index of the expression- Returns:
- the expression
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=#getExpressionListCount()
-
setExpression
public void setExpression(int index, Expression expr)Replaces the specified expression. Handle with care!- Parameters:
index- the 0-based index of the expressionexpr- the replacing expression- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=#getExpressionListCount()
-
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)
-
-