Package net.sf.saxon.ma.zeno
Class ZenoSequence
- java.lang.Object
-
- net.sf.saxon.ma.zeno.ZenoSequence
-
- All Implemented Interfaces:
GroundedValue
,Sequence
public class ZenoSequence extends java.lang.Object implements GroundedValue
An immutable XDM sequence implemented as a ZenoChain.This sequence implementation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ZenoSequence.ZenoSequenceIterator
A SequenceIterator over a ZenoSequence
-
Constructor Summary
Constructors Constructor Description ZenoSequence()
Construct an empty ZenoSequenceZenoSequence(ZenoChain<Item> chain)
Constructor to create a ZenoSequence that wraps a supplied ZenoChain
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ZenoSequence
append(Item item)
Append a single item to the end of the sequenceZenoSequence
appendSequence(GroundedValue items)
Append a sequence of item to the end of the sequencestatic ZenoSequence
fromList(java.util.List<Item> items)
Construct a ZenoSequence from a list of itemsint
getLength()
Get the length of the sequencejava.lang.String
getStringValue()
Get a string representation of the sequence, consisting of the space-separated concatenation of the string representation of the items in the sequenceUnicodeString
getUnicodeStringValue()
Get a string representation of the sequence, consisting of the space-separated concatenation of the string representation of the items in the sequenceItem
head()
Get the first item in the sequenceItem
itemAt(int n)
Get the item at a given position in the sequenceSequenceIterator
iterate()
Get an iterator over the items in the sequencestatic ZenoSequence
join(java.util.List<GroundedValue> segments)
Create a ZenoSequence by concatenating a number of sequencesGroundedValue
subsequence(int start, int length)
Get a subsequence of the value-
Methods 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
-
-
-
-
Method Detail
-
fromList
public static ZenoSequence fromList(java.util.List<Item> items)
Construct a ZenoSequence from a list of items- Parameters:
items
- the items to be included- Returns:
- the new ZenoSequence
-
iterate
public SequenceIterator 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
public Item itemAt(int n)
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
public Item 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
public GroundedValue subsequence(int start, int length)
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
public UnicodeString getUnicodeStringValue() throws XPathException
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
public java.lang.String getStringValue() throws XPathException
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
public ZenoSequence append(Item item)
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
public ZenoSequence appendSequence(GroundedValue items)
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
public static ZenoSequence join(java.util.List<GroundedValue> segments)
Create a ZenoSequence by concatenating a number of sequences- Parameters:
segments
- the sequences to be concatenated- Returns:
- the result of the concatenation
-
-