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 class
A 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 ZenoSequence
Construct a ZenoSequence from a list of itemsint
Get 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 ZenoSequence
join
(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, wait
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, effectiveBooleanValue, materialize, reduce, toShortString
Methods 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:
iterate
in interfaceGroundedValue
- Specified by:
iterate
in interfaceSequence
- Returns:
- an iterator over the items in the sequence
-
itemAt
Get the item at a given position in the sequence- Specified by:
itemAt
in 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:
head
in interfaceGroundedValue
- Specified by:
head
in interfaceSequence
- Returns:
- the first item in the sequence, or null if the sequence is empty
-
subsequence
Get a subsequence of the value- Specified by:
subsequence
in 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:
getLength
in 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:
getUnicodeStringValue
in 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:
getStringValue
in 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
-