Class PositionAndLast

    • Constructor Detail

      • PositionAndLast

        public PositionAndLast()
    • Method Detail

      • getNetCost

        public int getNetCost()
        Get an estimate of the net cost of evaluating the function, excluding the cost of evaluating its arguments. The result is 0 for very simple functions like position() and exists(), 1 by default, and higher values for particularly expensive functions.
        Overrides:
        getNetCost in class SystemFunction
        Returns:
        the estimated cost
      • bindContext

        public FunctionItem bindContext​(XPathContext context)
        Bind a context item to appear as part of the function's closure. If this method has been called, the supplied context item will be used in preference to the context item at the point where the function is actually called.
        Specified by:
        bindContext in class ContextAccessorFunction
        Parameters:
        context - the context to which the function applies. Must not be null.
      • getIntegerBounds

        public IntegerValue[] getIntegerBounds()
        For an expression that returns an integer or a sequence of integers, get a lower and upper bound on the values of the integers that may be returned, from static analysis. The default implementation returns null, meaning "unknown" or "not applicable". Other implementations return an array of two IntegerValue objects, representing the lower and upper bounds respectively. The values UNBOUNDED_LOWER and UNBOUNDED_UPPER are used by convention to indicate that the value may be arbitrarily large. The values MAX_STRING_LENGTH and MAX_SEQUENCE_LENGTH are used to indicate values limited by the size of a string or the size of a sequence.
        Overrides:
        getIntegerBounds in class SystemFunction
        Returns:
        the lower and upper bounds of integer values in the result, or null to indicate unknown or not applicable.
      • supplyTypeInformation

        public void supplyTypeInformation​(ExpressionVisitor visitor,
                                          ContextItemStaticInfo contextInfo,
                                          Expression[] arguments)
                                   throws XPathException
        Description copied from class: SystemFunction
        Method called during static type checking. This method may be implemented in subclasses so that functions can take advantage of knowledge of the types of the arguments that will be supplied.
        Overrides:
        supplyTypeInformation in class SystemFunction
        Parameters:
        visitor - an expression visitor, providing access to the static context and configuration
        contextInfo - information about whether the context item is set, and what its type is
        arguments - the expressions appearing as arguments in the function call
        Throws:
        XPathException - if an error is detected
      • isContextPossiblyUndefined

        public boolean isContextPossiblyUndefined()
        Ask whether the context item may possibly be undefined
        Returns:
        true if it might be undefined