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 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 Details

  • 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 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 Details

    • getOperation

      public String getOperation()
      Returns the name of the operation to be executed.
      Returns:
      the name of the operation
    • 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:
      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
    • inferDatatype

      public IDatatype inferDatatype() throws CSTSemanticException
      Description copied from class: ConstraintSyntaxTree
      Infers the datatype of the subtree represented by this object.
      Specified by:
      inferDatatype in class ConstraintSyntaxTree
      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: ConstraintSyntaxTree
      Visiting method for the visitor.
      This method is used for saving this model element.
      Specified by:
      accept in class ConstraintSyntaxTree
      Parameters:
      visitor - The visitor, which should save this model element.
    • 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(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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