Class CallExpression

    • Constructor Detail

      • CallExpression

        protected CallExpression()
                          throws VilException
        Constructor for serialization.
        Throws:
        VilException - shall not occur
      • CallExpression

        public CallExpression​(java.lang.Object parent,
                              java.lang.String name,
                              Expression... arguments)
                       throws VilException
        Creates a new (undotted) call expression.
        Parameters:
        parent - the parent language unit (if given used as optional parameter during calls)
        name - the name of the call
        arguments - the arguments for the call
        Throws:
        VilException - in case that no argument is given
      • CallExpression

        public CallExpression​(java.lang.Object parent,
                              java.lang.String name,
                              CallArgument... arguments)
                       throws VilException
        Creates a new (undotted) call expression.
        Parameters:
        parent - the parent language unit (if given used as optional parameter during calls)
        name - the name of the call.
        arguments - the arguments for the call
        Throws:
        VilException - in case that no argument is given
      • CallExpression

        public CallExpression​(java.lang.Object parent,
                              java.lang.String name,
                              boolean dotRight,
                              CallArgument... arguments)
                       throws VilException
        Creates a new call expression which may be part of a dot expression.
        Parameters:
        parent - the parent language unit (if given used as optional parameter during calls)
        name - the name of the call
        dotRight - if this expression occurred on the right side of a "."
        arguments - the arguments for the call
        Throws:
        VilException - in case that no argument is given
      • CallExpression

        public CallExpression​(OperationDescriptor operation,
                              CallArgument arg)
                       throws VilException
        Creates a new transparent call expression from a conversion or optimization operation.
        Parameters:
        operation - the operation to be considered
        arg - the one and only argument
        Throws:
        VilException - in case that the operation does not exactly take one argument and provide a result
      • CallExpression

        public CallExpression​(IMetaOperation operation,
                              CallArgument... param)
                       throws VilException
        Creates a new transparent call expression from a conversion or optimization operation.
        Parameters:
        operation - the operation to be considered
        param - the one and only parameter
        Throws:
        VilException - in case that the operation does not exactly take one argument and provide a result
    • Method Detail

      • getParent

        public java.lang.Object getParent()
        Returns the parent language unit.
        Returns:
        the parent language unit (may be null if not given or implicit operation)
      • doZeroArgumentTest

        protected boolean doZeroArgumentTest()
        Returns whether the zero argument test shall be applied.
        Returns:
        true if the test shall be applied, false else
      • isDotRightExpression

        public boolean isDotRightExpression()
        Returns whether this expression occurred on the right side of a dot expression (decompose while writing).
        Returns:
        true if it appeared on the right side, false else
      • getResolved

        public OperationDescriptor getResolved()
        Returns the resolved operation.
        Returns:
        the resolved operation
      • determineOperand

        protected TypeDescriptor<?> determineOperand()
                                              throws VilException
        Determines the operand for searching operations on. Is called by inferType().
        Returns:
        the operand
        Throws:
        VilException - in case that determining the operand fails
      • checkMetaForFirstArgField

        protected boolean checkMetaForFirstArgField()
        Returns whether the field meta type shall be checked in #resolveOperation().
        Returns:
        true
      • checkUseParameter

        private TypeDescriptor<?>[] checkUseParameter()
                                               throws VilException
        Checks whether one of the parameter / argument types shall be used.
        Returns:
        the parameter type or null
        Throws:
        VilException - in case of type problems
      • inferType

        public TypeDescriptor<?> inferType()
                                    throws VilException
        Description copied from class: Expression
        Infers the type of this expression including the type of the contained sub-expressions.
        Specified by:
        inferType in class Expression
        Returns:
        the type of this expression
        Throws:
        VilException - in case that inferring the type fails
      • considerReturnGenerics

        private TypeDescriptor<?> considerReturnGenerics​(TypeDescriptor<?> type,
                                                         TypeDescriptor<?>[] returnGenerics)
        Considers the return generics on type.
        Parameters:
        type - the type to consider the generics for
        returnGenerics - the return generics (may be null)
        Returns:
        the resulting descriptor or type if no return generics are given
      • accept

        public java.lang.Object accept​(IExpressionVisitor visitor)
                                throws VilException
        Description copied from class: Expression
        Visits the expression.
        Specified by:
        accept in class Expression
        Parameters:
        visitor - the visitor
        Returns:
        the result of visiting this expression (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • isIteratorCall

        public boolean isIteratorCall()
        Returns whether this call is an iterator call.
        Returns:
        true if it is an iterator call, false else
      • considerIteratorResult

        private TypeDescriptor<?> considerIteratorResult​(TypeDescriptor<?> result)
                                                  throws VilException
        Considers the potential explicit result type of an iterator.
        Parameters:
        result - the result type so far
        Returns:
        the result type
        Throws:
        VilException - if aggregation shall be applied to a non-aggregating iterator operation