public class SequenceSlice extends java.lang.Object implements GroundedValue
| Constructor and Description |
|---|
SequenceSlice(java.util.List<? extends Item> value,
int offset,
int length)
Construct an sequence from a slice of a list of items.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Iterable<? extends Item> |
asIterable()
Get the contents of this value in the form of a Java
Iterable,
so that it can be used in a for-each expression |
int |
getCardinality()
Determine the cardinality
|
int |
getLength()
Get the number of items in the sequence
|
java.lang.String |
getStringValue()
Get the string value of this sequence.
|
java.lang.CharSequence |
getStringValueCS()
Get the string value of this sequence.
|
Item |
head()
Get the first item in the sequence.
|
Item |
itemAt(int n)
Get the n'th item in the sequence (starting with 0 as the first item)
|
ListIterator<? extends Item> |
iterate()
Return an iterator over this sequence.
|
java.util.Iterator<? extends Item> |
iterator()
Get an iterator (a Java
Iterator) over the items in this sequence. |
GroundedValue |
reduce()
Reduce the sequence to its simplest form.
|
GroundedValue |
subsequence(int start,
int length)
Get a subsequence of the value
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitconcatenate, containsNode, effectiveBooleanValue, materialize, toShortStringmakeRepeatablepublic SequenceSlice(java.util.List<? extends Item> value, int offset, int length)
value - the list of itemsoffset - the zero-based position of the first item to be included in the sequencelength - the number of items to be included in the sequence; if this exceeds the number
of items available for inclusion, include all items up to the end of the sequencejava.lang.IndexOutOfBoundsException - if offset < 0 or length < 0 or offset + length < value.size()public java.lang.String getStringValue()
throws XPathException
GroundedValuegetStringValue in interface GroundedValueXPathException - if the sequence contains items that have no string value (for example, function items)public java.lang.CharSequence getStringValueCS()
throws XPathException
GroundedValuegetStringValueCS in interface GroundedValueXPathException - if the sequence contains items that have no string value (for example, function items)public Item head()
head in interface GroundedValuehead in interface Sequencepublic int getLength()
getLength in interface GroundedValuepublic int getCardinality()
Cardinalitypublic Item itemAt(int n)
itemAt in interface GroundedValuen - the position of the required itempublic ListIterator<? extends Item> iterate()
iterate in interface GroundedValueiterate in interface Sequencepublic GroundedValue subsequence(int start, int length)
subsequence in interface GroundedValuestart - 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 value goes off the end of the sequence, the result returns items up to the end
of the sequencepublic java.lang.String toString()
toString in class java.lang.Objectpublic GroundedValue reduce()
reduce in interface GroundedValuepublic java.lang.Iterable<? extends Item> asIterable()
Iterable,
so that it can be used in a for-each expressionasIterable in interface GroundedValuepublic java.util.Iterator<? extends Item> iterator()
Iterator) over the items in this sequence.Copyright (c) 2004-2020 Saxonica Limited.