public class SequenceSlice<T extends Item<?>> extends java.lang.Object implements GroundedValue<T>
| Constructor and Description |
|---|
SequenceSlice(java.util.List<T> 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<T> |
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.
|
T |
head()
Get the first item in the sequence.
|
T |
itemAt(int n)
Get the n'th item in the sequence (starting with 0 as the first item)
|
ListIterator<T> |
iterate()
Return an iterator over this sequence.
|
java.util.Iterator<T> |
iterator()
Get an iterator (a Java
Iterator) over the items in this sequence. |
GroundedValue<T> |
reduce()
Reduce the sequence to its simplest form.
|
GroundedValue<T> |
subsequence(int start,
int length)
Get a subsequence of the value
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waiteffectiveBooleanValue, materialize, toShortStringmakeRepeatablepublic SequenceSlice(java.util.List<T> 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 GroundedValue<T extends Item<?>>XPathException - if the sequence contains items that have no string value (for example, function items)public java.lang.CharSequence getStringValueCS()
throws XPathException
GroundedValuegetStringValueCS in interface GroundedValue<T extends Item<?>>XPathException - if the sequence contains items that have no string value (for example, function items)public T head()
public int getLength()
getLength in interface GroundedValue<T extends Item<?>>public int getCardinality()
Cardinalitypublic T itemAt(int n)
itemAt in interface GroundedValue<T extends Item<?>>n - the position of the required itempublic ListIterator<T> iterate()
public GroundedValue<T> subsequence(int start, int length)
subsequence in interface GroundedValue<T extends Item<?>>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 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<T> reduce()
reduce in interface GroundedValue<T extends Item<?>>public java.lang.Iterable<T> asIterable()
Iterable,
so that it can be used in a for-each expressionasIterable in interface GroundedValue<T extends Item<?>>asIterable in interface Sequence<T extends Item<?>>public java.util.Iterator<T> iterator()
Iterator) over the items in this sequence.Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.