Package net.sf.saxon.ma.zeno
Class ZenoSequence
java.lang.Object
net.sf.saxon.ma.zeno.ZenoSequence
- All Implemented Interfaces:
GroundedValue,Sequence
An immutable XDM sequence implemented as a ZenoChain.
This sequence implementation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA SequenceIterator over a ZenoSequence -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty ZenoSequenceZenoSequence(ZenoChain<Item> chain) Constructor to create a ZenoSequence that wraps a supplied ZenoChain -
Method Summary
Modifier and TypeMethodDescriptionAppend a single item to the end of the sequenceappendSequence(GroundedValue items) Append a sequence of item to the end of the sequencestatic ZenoSequenceConstruct a ZenoSequence from a list of itemsintGet the length of the sequenceGet a string representation of the sequence, consisting of the space-separated concatenation of the string representation of the items in the sequenceGet a string representation of the sequence, consisting of the space-separated concatenation of the string representation of the items in the sequencehead()Get the first item in the sequenceitemAt(int n) Get the item at a given position in the sequenceiterate()Get an iterator over the items in the sequencestatic ZenoSequencejoin(List<GroundedValue> segments) Create a ZenoSequence by concatenating a number of sequencessubsequence(int start, int length) Get a subsequence of the valueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, effectiveBooleanValue, materialize, reduce, toShortStringMethods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Constructor Details
-
ZenoSequence
public ZenoSequence()Construct an empty ZenoSequence -
ZenoSequence
Constructor to create a ZenoSequence that wraps a supplied ZenoChain- Parameters:
chain- the supplied ZenoChain
-
-
Method Details
-
fromList
Construct a ZenoSequence from a list of items- Parameters:
items- the items to be included- Returns:
- the new ZenoSequence
-
iterate
Get an iterator over the items in the sequence- Specified by:
iteratein interfaceGroundedValue- Specified by:
iteratein interfaceSequence- Returns:
- an iterator over the items in the sequence
-
itemAt
Get the item at a given position in the sequence- Specified by:
itemAtin interfaceGroundedValue- Parameters:
n- the index of the required item, with zero (0) representing the first item in the sequence- Returns:
- the item at the given position, or null if the position is out of range
-
head
Get the first item in the sequence- Specified by:
headin interfaceGroundedValue- Specified by:
headin interfaceSequence- Returns:
- the first item in the sequence, or null if the sequence is empty
-
subsequence
Get a subsequence of the value- Specified by:
subsequencein interfaceGroundedValue- 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 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 sequence- Returns:
- the required subsequence.
-
getLength
public int getLength()Get the length of the sequence- Specified by:
getLengthin interfaceGroundedValue- Returns:
- the number of items in the sequence
-
getUnicodeStringValue
Get a string representation of the sequence, consisting of the space-separated concatenation of the string representation of the items in the sequence- Specified by:
getUnicodeStringValuein interfaceGroundedValue- Returns:
- a Unicode string containing the result of getting the string value of each item in the sequence, space-separated
- Throws:
XPathException- if there is an item in the sequence with no string value, for example a map
-
getStringValue
Get a string representation of the sequence, consisting of the space-separated concatenation of the string representation of the items in the sequence- Specified by:
getStringValuein interfaceGroundedValue- Returns:
- a Unicode string containing the result of getting the string value of each item in the sequence, space-separated
- Throws:
XPathException- if there is an item in the sequence with no string value, for example a map
-
append
Append a single item to the end of the sequence- Parameters:
item- the item to be appended- Returns:
- a new sequence containing the additional item. The original sequence is unchanged.
-
appendSequence
Append a sequence of item to the end of the sequence- Parameters:
items- the items to be appended- Returns:
- a new sequence containing the additional items. The original sequence is unchanged.
-
join
Create a ZenoSequence by concatenating a number of sequences- Parameters:
segments- the sequences to be concatenated- Returns:
- the result of the concatenation
-