Package net.ssehub.easy.varModel.cst
Class ContainerInitializer
java.lang.Object
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
net.ssehub.easy.varModel.cst.ContainerInitializer
- All Implemented Interfaces:
IAttributeAccess
Represents an initializer for containers. This initializer may contain expressions for initializing container
entries. IVML:
{expression, ...}. We need a special constraint tree node for this purpose as
values form net.ssehub.easy.varModel.model.values are intended to be constants and, thus, cannot
contain arbitrary expressions.- Author:
- Holger Eichelberger
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionContainerInitializer(Container type, ConstraintSyntaxTree[] expressions) Creates a new container initializer. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(IConstraintTreeVisitor visitor) Visiting method for the visitor.booleangetExpression(int index) Returns the specified expression.intReturns the number of expressions.getType()Returns the type of the container.inthashCode()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 Details
-
type
-
expressions
-
-
Constructor Details
-
ContainerInitializer
public ContainerInitializer(Container type, ConstraintSyntaxTree[] expressions) throws CSTSemanticException Creates a new container initializer.- Parameters:
type- the type of the compoundexpressions- the initializing expressions (in sequence for containers which support sequences)- Throws:
CSTSemanticException- in case that the initialization fails, element type mismatch
-
-
Method Details
-
getType
Returns the type of the container.- Returns:
- the type of the container
-
getExpressionCount
public int getExpressionCount()Returns the number of expressions.- Returns:
- the number of expressions
-
getExpression
Returns the specified expression.- Parameters:
index- the index of the expression to be returned- Returns:
- the specified expression
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >=getExpressionCount()
-
accept
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
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.
-
equals
-
hashCode
public int hashCode()
-