Class CoreOperation

    • Field Detail

      • AND_PRECEDENCE

        protected static final int AND_PRECEDENCE
        and precedence
        See Also:
        Constant Field Values
      • COMPARE_PRECEDENCE

        protected static final int COMPARE_PRECEDENCE
        compare precedence
        See Also:
        Constant Field Values
      • RELATIONAL_EXPR_PRECEDENCE

        protected static final int RELATIONAL_EXPR_PRECEDENCE
        relational expression precedence
        See Also:
        Constant Field Values
      • ADD_PRECEDENCE

        protected static final int ADD_PRECEDENCE
        add/subtract precedence
        See Also:
        Constant Field Values
      • MULTIPLY_PRECEDENCE

        protected static final int MULTIPLY_PRECEDENCE
        multiply/divide/mod precedence
        See Also:
        Constant Field Values
      • NEGATE_PRECEDENCE

        protected static final int NEGATE_PRECEDENCE
        negate precedence
        See Also:
        Constant Field Values
      • UNION_PRECEDENCE

        protected static final int UNION_PRECEDENCE
        union precedence
        See Also:
        Constant Field Values
    • Constructor Detail

      • CoreOperation

        public CoreOperation​(Expression[] args)
        Create a new CoreOperation.
        Parameters:
        args - Expression[]
    • Method Detail

      • compute

        public java.lang.Object compute​(EvalContext context)
        Description copied from class: Expression
        Evaluates the expression. If the result is a node set, returns the first element of the node set.
        Specified by:
        compute in class Expression
        Parameters:
        context - evaluation context
        Returns:
        Object
      • computeValue

        public abstract java.lang.Object computeValue​(EvalContext context)
        Description copied from class: Expression
        Evaluates the expression. If the result is a node set, returns the first element of the node set.
        Specified by:
        computeValue in class Expression
        Parameters:
        context - evaluation context
        Returns:
        Object
      • getSymbol

        public abstract java.lang.String getSymbol()
        Returns the XPath symbol for this operation, e.g. "+", "div", etc.
        Returns:
        String symbol
      • isSymmetric

        protected abstract boolean isSymmetric()
        Returns true if the operation is not sensitive to the order of arguments, e.g. "=", "and" etc, and false if it is, e.g. "<=", "div".
        Returns:
        boolean
      • getPrecedence

        protected abstract int getPrecedence()
        Computes the precedence of the operation.
        Returns:
        int precedence
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • parenthesize

        private java.lang.String parenthesize​(Expression expression,
                                              boolean left)
        Wrap an expression in parens if necessary.
        Parameters:
        expression - other Expression
        left - whether expression is left of this one.
        Returns:
        String