public interface GroundedValue extends Sequence
Modifier and Type | Method and Description |
---|---|
default java.lang.Iterable<? extends Item> |
asIterable()
Get an
Iterable that wraps this GroundedValue , allowing
it to be used in a Java for-each loop. |
default GroundedValue |
concatenate(GroundedValue... others)
Append two or more grounded values to form a new grounded value
|
default boolean |
containsNode(NodeInfo sought)
Determine whether a particular node is present in the value
|
default boolean |
effectiveBooleanValue()
Get the effective boolean value of this sequence
|
int |
getLength()
Get the size of the value (the number of items in the value, considered as a sequence)
|
java.lang.String |
getStringValue()
Get the string value of this sequence, as an instance of
String . |
UnicodeString |
getUnicodeStringValue()
Get the string value of this sequence, as an instance of
UnicodeString . |
Item |
head()
Get the first item of the sequence.
|
Item |
itemAt(int n)
Get the n'th item in the value, counting from zero (0)
|
SequenceIterator |
iterate()
Get an iterator over all the items in the sequence.
|
default GroundedValue |
materialize()
Create a
GroundedValue containing the same items as this Sequence. |
default GroundedValue |
reduce()
Reduce the sequence to its simplest form.
|
GroundedValue |
subsequence(int start,
int length)
Get a subsequence of the value
|
default java.lang.String |
toShortString()
Produce a short representation of the value of the sequence, suitable for use in error messages
|
makeRepeatable
SequenceIterator iterate()
iterate
in interface Sequence
SequenceIterator
rather than a Java
Iterator
) over all the items in this Sequence.Item itemAt(int n)
n
- the index of the required item, with zero (0) representing the first item in the sequenceItem head()
GroundedValue subsequence(int start, int length)
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 returnedlength
- 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 sequenceint getLength()
default boolean effectiveBooleanValue() throws XPathException
XPathException
- if the sequence has no effective boolean value (for example a sequence of two integers)UnicodeString getUnicodeStringValue() throws XPathException
UnicodeString
.
The string value of an item is the result of applying the XPath 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
The result of this method is always equivalent to the result of the getStringValue()
method.
Use this method in preference either (a) if you need to use the value in a context where a UnicodeString
is required, or (b) if the underlying value is held as a UnicodeString
, or in a form that is readily
converted to a UnicodeString
. This is typically the case (i) when the value is a text or element node
in a TinyTree, and (ii) when the value is a StringItem
: that is, an atomic value of type
xs:string
.
XPathException
- if the sequence contains items that have no string value (for example, function items)java.lang.String getStringValue() throws XPathException
String
.
The string value of an item is the result of applying the XPath 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.
The result of this method is always equivalent to the result of the getUnicodeStringValue()
method.
Use this method in preference either (a) if you need to use the value in a context where a String
is required, or (b) if the underlying value is held as a String
, or in a form that is readily
converted to a String
. This is typically the case (i) when the value is an attribute node
in a TinyTree, or (ii) any kind of node in a third-party tree model such as DOM.
XPathException
- if the sequence contains items that have no string value (for example, function items)default GroundedValue reduce()
default GroundedValue materialize()
GroundedValue
containing the same items as this Sequence.
Since this Sequence is already a GroundedValue
this method returns
this GroundedValue
unchanged.materialize
in interface Sequence
GroundedValue
default java.lang.String toShortString()
default java.lang.Iterable<? extends Item> asIterable()
Iterable
that wraps this GroundedValue
, allowing
it to be used in a Java for-each loop.default boolean containsNode(NodeInfo sought) throws XPathException
sought
- the sought-after nodeXPathException
- This should never happendefault GroundedValue concatenate(GroundedValue... others)
others
- one or more grounded values that are to be concatenated with this
one, in orderCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.