Class 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 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
    • 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 on
        operation - the name of the operation to be executed
        expression - 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.
        use getContainer() instead
        Returns 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 - if index<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
      • getResolvedOperation

        public Operation getResolvedOperation()
        Returns the resolved operation. The result is only valid if inferDatatype() 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:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.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