Package net.ssehub.easy.varModel.cst
Class ContainerOperationCall
java.lang.Object
net.ssehub.easy.varModel.cst.ConstraintSyntaxTree
net.ssehub.easy.varModel.cst.ContainerOperationCall
- All Implemented Interfaces:
IAttributeAccess
Represents a set operation call with declarators, e.g. a quantor call.
Apply and lambda-Expression: For the moment we denote a lambda expression as
setOf(Integer) set;
set->apply(t,r=0|max(t,r))
An usual operation is iterated over all elements of the set using the declarator
t while the result is collected in r by subsequent
application of r=max(t,r) on each t in set.
r is returned as result of the lambda expression.- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ConstraintSyntaxTreeprivate DecisionVariableDeclaration[]private ConstraintSyntaxTreeprivate IDatatypeprivate Stringprivate Operationprivate IDatatype -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for serialization.ContainerOperationCall(ConstraintSyntaxTree container, String operation, ConstraintSyntaxTree expression, DecisionVariableDeclaration... declarators) Creates a new let expression. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(IConstraintTreeVisitor visitor) Visiting method for the visitor.booleanReturns the set to operate on (given as an expression).Returns the actual container type taking into account that the left side must not be a container but can dynamically be mapped into one.getDeclarator(int index) Returns the specified declarator.intReturns the number of declarators.Returns the iterating expression.Returns the iterator base type (the type contained in the container we are iterating over).Returns the name of the operation to be executed.Returns the resolved operation.getSet()Deprecated.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
-
container
-
operation
-
declarators
-
expression
-
resolvedOperation
-
result
-
iteratorBase
-
-
Constructor Details
-
ContainerOperationCall
ContainerOperationCall()Constructor for serialization. -
ContainerOperationCall
public ContainerOperationCall(ConstraintSyntaxTree container, String operation, ConstraintSyntaxTree expression, DecisionVariableDeclaration... declarators) Creates a new let expression.- Parameters:
container- the container to operate onoperation- the name of the operation to be executedexpression- the expression to be iterated (using at least one declarator)declarators- local variables only used within this expression (at least one)
-
-
Method Details
-
getOperation
Returns the name of the operation to be executed.- Returns:
- the name of the operation
-
getSet
Deprecated.usegetContainer()insteadReturns the set to operate on (given as an expression).- Returns:
- the set to operate on
-
getContainer
Returns the set to operate on (given as an expression).- Returns:
- the set to operate on
-
getExpression
Returns the iterating expression.- Returns:
- the iterating expression
-
getDeclaratorsCount
public int getDeclaratorsCount()Returns the number of declarators.- Returns:
- the number of declarators (should be positive)
-
getDeclarator
Returns the specified declarator.- Parameters:
index- the index of the declarator to return- Returns:
- the specified declarator
- Throws:
IndexOutOfBoundsException- ifindex<0 || index>=getDeclaratorsCount()
-
getContainerType
Returns the actual container type taking into account that the left side must not be a container but can dynamically be mapped into one.- Returns:
- the actual container type
- Throws:
CSTSemanticException- if types cannot be resolved
-
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.
-
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.
-
getResolvedOperation
Returns the resolved operation. The result is only valid ifinferDatatype()was called before this operation.- Returns:
- the resolved operation, null if the operation cannot
be resolved or
inferDatatype()was not called before
-
equals
-
hashCode
public int hashCode() -
getIteratorBaseType
Returns the iterator base type (the type contained in the container we are iterating over).- Returns:
- the iterator base type
-
getContainer()instead