Class CompareToConstant

    • Field Detail

      • operator

        protected int operator
    • Constructor Detail

      • CompareToConstant

        public CompareToConstant​(Expression p0)
    • Method Detail

      • getImplementationMethod

        public int getImplementationMethod()
        An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.
        Specified by:
        getImplementationMethod in class Expression
        Returns:
        the value Expression.EVALUATE_METHOD
      • computeSpecialProperties

        public int computeSpecialProperties()
        Description copied from class: UnaryExpression
        Get the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.
        Overrides:
        computeSpecialProperties in class UnaryExpression
        Returns:
        the special properties, as a bit-significant integer
      • evaluateItem

        public BooleanValue 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
      • optimize

        public Expression optimize​(ExpressionVisitor visitor,
                                   ContextItemStaticInfo contextInfo)
                            throws XPathException
        Perform optimisation of an expression and its subexpressions. This is the third and final phase of static optimization.

        This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

        Overrides:
        optimize in class UnaryExpression
        Parameters:
        visitor - the 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 original expression, rewritten if appropriate to optimize execution
        Throws:
        XPathException - if an error is discovered during this phase (typically a type error)
      • getItemType

        public ItemType getItemType()
        Determine the data type of the expression, if possible. All expression return sequences, in general; this method determines the type of the items within the sequence, assuming that (a) this is known in advance, and (b) it is the same for all items in the sequence.

        This method should always return a result, though it may be the best approximation that is available at the time.

        Overrides:
        getItemType in class UnaryExpression
        Returns:
        a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
      • getSingletonOperator

        public int getSingletonOperator()
        Get the primitive (singleton) operator used: one of Token.FEQ, Token.FNE, Token.FLT, Token.FGT, Token.FLE, Token.FGE
        Specified by:
        getSingletonOperator in interface ComparisonExpression
      • convertsUntypedToOther

        public boolean convertsUntypedToOther()
        Determine whether untyped atomic values should be converted to the type of the other operand
        Specified by:
        convertsUntypedToOther in interface ComparisonExpression
        Returns:
        true if untyped values should be converted to the type of the other operand, false if they should be converted to strings.