Package net.ssehub.easy.varModel.cst
Class BlockExpression
- java.lang.Object
-
- net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
-
- net.ssehub.easy.varModel.cst.BlockExpression
-
- All Implemented Interfaces:
IAttributeAccess
public class BlockExpression extends ConstraintSyntaxTree
Represents a block of expressions. The type of the block as well as its value are determined by the last (non-comment) expression in the block.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private ConstraintSyntaxTree[]exprsprivate IDatatypetype
-
Constructor Summary
Constructors Constructor Description BlockExpression(ConstraintSyntaxTree[] exprs)Creates a block expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IConstraintTreeVisitor visitor)Visiting method for the visitor.ConstraintSyntaxTreegetExpression(int index)Returns the specified expression.intgetExpressionCount()Returns the number of expressions.IDatatypeinferDatatype()Infers the datatype of the subtree represented by this object.-
Methods inherited from class net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
getAttribute, getAttribute, getAttributesCount, getContainedType, getName, getParent, isSemanticallyEqual
-
-
-
-
Field Detail
-
exprs
private ConstraintSyntaxTree[] exprs
-
type
private IDatatype type
-
-
Constructor Detail
-
BlockExpression
public BlockExpression(ConstraintSyntaxTree[] exprs) throws CSTSemanticException
Creates a block expression.- Parameters:
exprs- the expressions in the block- Throws:
CSTSemanticException- in case that no expressions are given
-
-
Method Detail
-
getExpressionCount
public int getExpressionCount()
Returns the number of expressions.- Returns:
- the number of expressions
-
getExpression
public ConstraintSyntaxTree getExpression(int index)
Returns the specified expression.- Parameters:
index- the index of the expression- Returns:
- the specified index
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getExpressionCount()
-
accept
public void accept(IConstraintTreeVisitor visitor)
Description copied from class:ConstraintSyntaxTreeVisiting method for the visitor.
This method is used for saving this model element.- Specified by:
acceptin classConstraintSyntaxTree- Parameters:
visitor- The visitor, which should save this model element.
-
inferDatatype
public IDatatype inferDatatype() throws CSTSemanticException
Description copied from class:ConstraintSyntaxTreeInfers the datatype of the subtree represented by this object.- Specified by:
inferDatatypein classConstraintSyntaxTree- Returns:
- the data type
- Throws:
CSTSemanticException- Will be thrown if parameters of (sub-) trees do not fit together.
-
-