Class SimpleExpression

    • Constructor Detail

      • SimpleExpression

        public SimpleExpression()
        Constructor
    • Method Detail

      • setOperanda

        protected void setOperanda​(OperandArray operanda)
        Set the data structure for the operands of this expression. This must be created during initialisation of the expression and must not be subsequently changed
        Parameters:
        operanda - the data structure for expression operands
      • getOperanda

        protected OperandArray getOperanda()
        Get the data structure holding the operands of this expression.
        Returns:
        the data structure holding expression operands
      • operands

        public java.lang.Iterable<Operand> operands()
        Description copied from class: Expression
        Get the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent expression. Default implementation works off the results of iterateSubExpressions()

        If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.

        Overrides:
        operands in class Expression
        Returns:
        an iterator containing the sub-expressions of this expression
      • setArguments

        public void setArguments​(Expression[] sub)
        Set the immediate sub-expressions of this expression.
        Parameters:
        sub - an array containing the sub-expressions of this expression
      • copy

        public Expression copy​(RebindingMap rebindings)
        Copy an expression. This makes a deep copy.
        Specified by:
        copy in class Expression
        Parameters:
        rebindings - variables that need to be re-bound
        Returns:
        the copy of the original expression
      • copyOperandsFrom

        protected SimpleExpression copyOperandsFrom​(SimpleExpression se1)
        Helper method for subclasses to implement the copy() operation: this method can be applied to the new expression to copy operands from the old expressions
        Parameters:
        se1 - the expression being copied
        Returns:
        the target object of this method (for convenience)
      • getItemType

        public ItemType getItemType()
        Determine the data type of the items returned by this expression. This implementation returns "item()", which can be overridden in a subclass.
        Specified by:
        getItemType in class Expression
        Returns:
        the data type
      • evaluateItem

        public final Item evaluateItem​(XPathContext context)
                                throws XPathException
        Evaluate an expression as a single item. This always returns either a single Item or null (denoting the empty sequence). No conversion is done. This method should not be used unless the static type of the expression is a subtype of "item" or "item?": that is, it should not be called if the expression may return a sequence. There is no guarantee that this condition will be detected.
        Overrides:
        evaluateItem in class Expression
        Parameters:
        context - The context in which the expression is to be evaluated
        Returns:
        the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
        Throws:
        XPathException - if any dynamic error occurs evaluating the expression
      • iterate

        public final SequenceIterator iterate​(XPathContext context)
                                       throws XPathException
        Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.
        Overrides:
        iterate in class Expression
        Parameters:
        context - supplies the context for evaluation
        Returns:
        a SequenceIterator that can be used to iterate over the result of the expression
        Throws:
        XPathException - if any dynamic error occurs evaluating the expression
      • process

        public final void process​(Outputter output,
                                  XPathContext context)
                           throws XPathException
        Process the instruction, without returning any tail calls
        Overrides:
        process in class Expression
        Parameters:
        output - the destination for the result
        context - The dynamic context, giving access to the current node,
        Throws:
        XPathException - if a dynamic error occurs
      • export

        public void export​(ExpressionPresenter destination)
                    throws XPathException
        Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
        Specified by:
        export in interface ExportAgent
        Specified by:
        export in class Expression
        Parameters:
        destination - the expression presenter used to display the structure
        Throws:
        XPathException - if the export fails, for example if an expression is found that won't work in the target environment.
      • getExpressionType

        public java.lang.String getExpressionType()
        Return a distinguishing name for the expression, for use in diagnostics. By default the class name is used.
        Returns:
        a distinguishing name for the expression (defaults to the name of the implementation class)