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
public class ContainerOperationCall extends ConstraintSyntaxTree
Represents a set operation call with declarators, e.g. a quantor call. Apply and lambda-Expression: For the moment we denote a lambda expression assetOf(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
Fields Modifier and Type Field Description private ConstraintSyntaxTreecontainerprivate DecisionVariableDeclaration[]declaratorsprivate ConstraintSyntaxTreeexpressionprivate IDatatypeiteratorBaseprivate java.lang.Stringoperationprivate OperationresolvedOperationprivate IDatatyperesult
-
Constructor Summary
Constructors Constructor Description ContainerOperationCall()Constructor for serialization.ContainerOperationCall(ConstraintSyntaxTree container, java.lang.String operation, ConstraintSyntaxTree expression, DecisionVariableDeclaration... declarators)Creates a new let expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(IConstraintTreeVisitor visitor)Visiting method for the visitor.booleanequals(java.lang.Object obj)ConstraintSyntaxTreegetContainer()Returns the set to operate on (given as an expression).IDatatypegetContainerType()Returns the actual container type taking into account that the left side must not be a container but can dynamically be mapped into one.DecisionVariableDeclarationgetDeclarator(int index)Returns the specified declarator.intgetDeclaratorsCount()Returns the number of declarators.ConstraintSyntaxTreegetExpression()Returns the iterating expression.IDatatypegetIteratorBaseType()Returns the iterator base type (the type contained in the container we are iterating over).java.lang.StringgetOperation()Returns the name of the operation to be executed.OperationgetResolvedOperation()Returns the resolved operation.ConstraintSyntaxTreegetSet()Deprecated.usegetContainer()insteadinthashCode()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
-
container
private ConstraintSyntaxTree container
-
operation
private java.lang.String operation
-
declarators
private DecisionVariableDeclaration[] declarators
-
expression
private ConstraintSyntaxTree expression
-
resolvedOperation
private Operation resolvedOperation
-
result
private IDatatype result
-
iteratorBase
private IDatatype iteratorBase
-
-
Constructor Detail
-
ContainerOperationCall
ContainerOperationCall()
Constructor for serialization.
-
ContainerOperationCall
public ContainerOperationCall(ConstraintSyntaxTree container, java.lang.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 Detail
-
getOperation
public java.lang.String getOperation()
Returns the name of the operation to be executed.- Returns:
- the name of the operation
-
getSet
@Deprecated public ConstraintSyntaxTree getSet()
Deprecated.usegetContainer()insteadReturns the set to operate on (given as an expression).- Returns:
- the set to operate on
-
getContainer
public ConstraintSyntaxTree getContainer()
Returns the set to operate on (given as an expression).- Returns:
- the set to operate on
-
getExpression
public ConstraintSyntaxTree 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
public DecisionVariableDeclaration getDeclarator(int index)
Returns the specified declarator.- Parameters:
index- the index of the declarator to return- Returns:
- the specified declarator
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getDeclaratorsCount()
-
getContainerType
public IDatatype getContainerType() throws CSTSemanticException
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
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.
-
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.
-
getResolvedOperation
public Operation 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
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getIteratorBaseType
public IDatatype getIteratorBaseType()
Returns the iterator base type (the type contained in the container we are iterating over).- Returns:
- the iterator base type
-
-