Package net.ssehub.easy.varModel.cst
Class CompoundInitializer
java.lang.Object
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
net.ssehub.easy.varModel.cst.CompoundInitializer
- All Implemented Interfaces:
IAttributeAccess
Represents a typed initializer for compounds. This initializer may contain expressions for initializing compound
slots. IVML:
Type{slot=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
FieldsModifier and TypeFieldDescriptionprivate ConstraintSyntaxTree[]private AbstractVariable[]private String[]private Compound -
Constructor Summary
ConstructorsConstructorDescriptionCompoundInitializer(Compound type, String[] slots, AbstractVariable[] slotDecls, ConstraintSyntaxTree[] expressions) Creates a new compound 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 / slots.getSlot(int index) Returns the specified slot name.intReturns the number of expressions / slots.getSlotDeclaration(int index) Returns the declaration of the specified slot.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
-
slots
-
slotDecls
-
-
Constructor Details
-
CompoundInitializer
public CompoundInitializer(Compound type, String[] slots, AbstractVariable[] slotDecls, ConstraintSyntaxTree[] expressions) throws CSTSemanticException Creates a new compound initializer.- Parameters:
type- the type of the compoundslots- the names of the slots. Note that the index of the name denotes the slot related to the expression at the same index position inexpressions.slotDecls- the declarations of the slots. Note that the index of the name denotes the slot related to the expression at the same index position inexpressions.expressions- the initializing expressions. Note that the index of the expression denotes the slot related to the name at the same index position inslots.- Throws:
CSTSemanticException- in case that the initialization fails
-
-
Method Details
-
getType
Returns the type of the container.- Returns:
- the type of the container
-
getSlotCount
public int getSlotCount()Returns the number of expressions / slots.- Returns:
- the number of expressions / slots
-
getExpressionCount
public int getExpressionCount()Returns the number of expressions / slots.- Returns:
- the number of expressions / slots
-
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()
-
getSlot
Returns the specified slot name.- Parameters:
index- the index of the expression to be returned- Returns:
- the specified slot name
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >=getSlotCount()
-
getSlotDeclaration
Returns the declaration of the specified slot.- Parameters:
index- the index of the expression to be returned- Returns:
- the specified slot declaration
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >=getSlotCount()
-
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()
-