Class GeneralComparison10

  • All Implemented Interfaces:
    Callable, ExportAgent, Locatable, IdentityComparable, Traceable

    public class GeneralComparison10
    extends BinaryExpression
    implements Callable
    GeneralComparison10: a boolean expression that compares two expressions for equals, not-equals, greater-than or less-than. This implements the operators =, !=, <, >, etc. This version of the class implements general comparisons in XPath 1.0 backwards compatibility mode.
    • Field Detail

      • singletonOperator

        protected int singletonOperator
    • Constructor Detail

      • GeneralComparison10

        public GeneralComparison10​(Expression p0,
                                   int op,
                                   Expression p1)
        Create a general comparison identifying the two operands and the operator
        Parameters:
        p0 - the left-hand operand
        op - the operator, as a token returned by the Tokenizer (e.g. Token.LT)
        p1 - the right-hand operand
    • Method Detail

      • typeCheck

        public Expression typeCheck​(ExpressionVisitor visitor,
                                    ContextItemStaticInfo contextInfo)
                             throws XPathException
        Type-check the expression
        Overrides:
        typeCheck in class BinaryExpression
        Parameters:
        visitor - an expression visitor
        contextInfo - Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.
        Returns:
        the checked expression
        Throws:
        XPathException - if an error is discovered during this phase (typically a type error)
      • setAtomicComparer

        public void setAtomicComparer​(AtomicComparer comparer)
      • optimize

        public Expression optimize​(ExpressionVisitor visitor,
                                   ContextItemStaticInfo contextInfo)
                            throws XPathException
        Optimize the expression
        Overrides:
        optimize in class BinaryExpression
        Parameters:
        visitor - an expression visitor
        contextInfo - the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to Type.ITEM_TYPE
        Returns:
        the checked expression
        Throws:
        XPathException - if an error is discovered during this phase (typically a type error)
      • evaluateItem

        public BooleanValue evaluateItem​(XPathContext context)
                                  throws XPathException
        Evaluate the expression in a given context
        Overrides:
        evaluateItem in class Expression
        Parameters:
        context - the given context for evaluation
        Returns:
        a BooleanValue representing the result of the numeric comparison of the two operands
        Throws:
        XPathException - if any dynamic error occurs evaluating the expression
      • call

        public BooleanValue call​(XPathContext context,
                                 Sequence[] arguments)
                          throws XPathException
        Evaluate the expression: interface for use by compiled bytecode
        Specified by:
        call in interface Callable
        Parameters:
        context - the dynamic evaluation context
        arguments - the values of the arguments, supplied as SequenceIterators
        Returns:
        the result of the evaluation, in the form of a SequenceIterator
        Throws:
        XPathException - if a dynamic error occurs during the evaluation of the expression
      • effectiveBooleanValue

        public boolean effectiveBooleanValue​(XPathContext context)
                                      throws XPathException
        Evaluate the expression giving a boolean result
        Overrides:
        effectiveBooleanValue in class Expression
        Parameters:
        context - the given context for evaluation
        Returns:
        a boolean representing the result of the comparison of the two operands
        Throws:
        XPathException - if any dynamic error occurs evaluating the 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 must be re-bound
        Returns:
        the copy of the original expression
      • getItemType

        public ItemType getItemType()
        Determine the data type of the expression
        Specified by:
        getItemType in class Expression
        Returns:
        Type.BOOLEAN
      • explainExtraAttributes

        protected void explainExtraAttributes​(ExpressionPresenter out)
        Description copied from class: BinaryExpression
        Add subclass-specific attributes to the expression tree explanation. Default implementation does nothing; this is provided for subclasses to override.
        Overrides:
        explainExtraAttributes in class BinaryExpression
        Parameters:
        out - the output destination for the displayed expression tree
      • tag

        protected java.lang.String tag()
        Description copied from class: BinaryExpression
        Get the element name used to identify this expression in exported expression format
        Overrides:
        tag in class BinaryExpression
        Returns:
        the element name used to identify this expression