Interface GroundedValue

    • Method Detail

      • iterate

        UnfailingIterator iterate()
        Get an iterator over all the items in the sequence. This differs from the superclass method in not allowing an exception, either during this method call, or in the subsequent processing of the returned iterator.
        Specified by:
        iterate in interface Sequence
        Returns:
        an iterator (meaning a Saxon SequenceIterator rather than a Java Iterator) over all the items in this Sequence.
      • itemAt

        Item itemAt​(int n)
        Get the n'th item in the value, counting from zero (0)
        Parameters:
        n - the index of the required item, with zero (0) representing the first item in the sequence
        Returns:
        the n'th item if it exists, or null if the requested position is out of range
      • head

        Item head()
        Get the first item of the sequence. This differs from the parent interface in not allowing an exception
        Specified by:
        head in interface Sequence
        Returns:
        the first item of the sequence, or null if the sequence is empty
      • subsequence

        GroundedValue subsequence​(int start,
                                  int length)
        Get a subsequence of the value
        Parameters:
        start - the index of the first item to be included in the result, counting from zero. A negative value is taken as zero. If the value is beyond the end of the sequence, an empty sequence is returned
        length - the number of items to be included in the result. Specify Integer.MAX_VALUE to get the subsequence up to the end of the base sequence. If the value is negative, an empty sequence is returned. If the length goes off the end of the sequence, the result returns items up to the end of the sequence
        Returns:
        the required subsequence.
      • getLength

        int getLength()
        Get the size of the value (the number of items in the value, considered as a sequence)
        Returns:
        the number of items in the sequence. Note that for a single item, including a map or array, the result is always 1 (one).
      • effectiveBooleanValue

        default boolean effectiveBooleanValue()
                                       throws XPathException
        Get the effective boolean value of this sequence
        Returns:
        the effective boolean value
        Throws:
        XPathException - if the sequence has no effective boolean value (for example a sequence of two integers)
      • getStringValue

        java.lang.String getStringValue()
                                 throws XPathException
        Get the string value of this sequence. The string value of an item is the result of applying the string() function. The string value of a sequence is the space-separated result of applying the string-join() function using a single space as the separator
        Returns:
        the string value of the sequence.
        Throws:
        XPathException - if the sequence contains items that have no string value (for example, function items)
      • getStringValueCS

        java.lang.CharSequence getStringValueCS()
                                         throws XPathException
        Get the string value of this sequence. The string value of an item is the result of applying the string() function. The string value of a sequence is the space-separated result of applying the string-join() function using a single space as the separator
        Returns:
        the string value of the sequence.
        Throws:
        XPathException - if the sequence contains items that have no string value (for example, function items)
      • reduce

        default GroundedValue reduce()
        Reduce the sequence to its simplest form. If the value is an empty sequence, the result will be EmptySequence.getInstance(). If the value is a single atomic value, the result will be an instance of AtomicValue. If the value is a single item of any other kind, the result will be an instance of Item. Otherwise, the result will typically be unchanged.
        Returns:
        the simplified sequence
      • materialize

        default GroundedValue materialize()
        Create a GroundedValue containing the same items as this Sequence. Since this Sequence is already a GroundedValue this method returns this GroundedValue unchanged.
        Specified by:
        materialize in interface Sequence
        Returns:
        this GroundedValue
      • toShortString

        default java.lang.String toShortString()
        Produce a short representation of the value of the sequence, suitable for use in error messages
        Returns:
        a short representation of the value
      • asIterable

        default java.lang.Iterable<? extends Item> asIterable()
      • containsNode

        default boolean containsNode​(NodeInfo sought)
                              throws XPathException
        Determine whether a particular node is present in the value
        Parameters:
        sought - the sought-after node
        Returns:
        true if the sought node is present
        Throws:
        XPathException - This should never happen
      • concatenate

        default GroundedValue concatenate​(GroundedValue... others)
        Append two or more grounded values to form a new grounded value
        Parameters:
        others - one or more grounded values that are to be concatenated with this one, in order
        Returns:
        the concatenation of the supplied sequences (none of which is modified by the operation)