public class SequenceTool extends Object
Modifier and Type | Field and Description |
---|---|
static int |
INDETERMINATE_ORDERING
Constant returned by compareTo() method to indicate an indeterminate ordering between two values
|
Constructor and Description |
---|
SequenceTool() |
Modifier and Type | Method and Description |
---|---|
static Item |
asItem(Sequence sequence)
Static method to make an Item from a Value
|
static Object |
convertToJava(Item item)
Convert an XPath value to a Java object.
|
static int |
getCardinality(Sequence sequence) |
static ItemType |
getItemType(Sequence sequence,
TypeHierarchy th) |
static int |
getLength(Sequence sequence)
Get the length of a sequence (the number of items it contains)
|
static String |
getStringValue(Sequence sequence) |
static Item |
itemAt(Sequence sequence,
int index)
Get the item at a given offset in a sequence.
|
static void |
process(Sequence value,
XPathContext context,
int locationId)
Process the value as an instruction, without returning any tail calls
|
static GroundedValue |
toGroundedValue(Sequence sequence)
Produce a GroundedValue containing the same values as a supplied sequence.
|
static GroundedValue |
toGroundedValue(SequenceIterator iterator)
Produce a GroundedValue containing the same values as a supplied sequence.
|
static Sequence |
toLazySequence(SequenceIterator iterator)
Construct a sequence capable of returning the same items as an iterator,
without incurring the cost of evaluating the iterator and storing all
the items.
|
static Sequence |
toMemoSequence(SequenceIterator iterator)
Produce a Sequence containing the same values as a supplied sequence; the input is
read progressively as required, and saved in a buffer as it is read in case it is needed
again.
|
public static final int INDETERMINATE_ORDERING
public static GroundedValue toGroundedValue(Sequence sequence) throws XPathException
sequence
- the supplied sequenceXPathException
public static GroundedValue toGroundedValue(SequenceIterator iterator) throws XPathException
iterator
- the supplied sequence. The iterator may or may not be consumed as a result of
passing it to this method.XPathException
- if a failure occurs reading the input iteratorpublic static Sequence toMemoSequence(SequenceIterator iterator) throws XPathException
iterator
- the supplied sequence. The iterator may or may not be consumed as a result of
passing it to this method.XPathException
- if a failure occurs reading the input iteratorpublic static Sequence toLazySequence(SequenceIterator iterator) throws XPathException
iterator
- the supplied sequence. The iterator may or may not be consumed as a result of
passing it to this method.XPathException
- if a failure occurs reading the input iteratorpublic static int getLength(Sequence sequence) throws XPathException
sequence
- the sequenceXPathException
public static Item itemAt(Sequence sequence, int index) throws XPathException
sequence
- the input sequenceindex
- the 0-based subscriptXPathException
public static Item asItem(Sequence sequence) throws XPathException
sequence
- the value to be convertedXPathException
- if the supplied Sequence contains multiple itemspublic static Object convertToJava(Item item) throws XPathException
item
- the item to be convertedXPathException
- if an error occurs: for example, if the XPath value is
an integer and is too big to fit in a Java longpublic static String getStringValue(Sequence sequence) throws XPathException
XPathException
public static ItemType getItemType(Sequence sequence, TypeHierarchy th)
public static int getCardinality(Sequence sequence)
public static void process(Sequence value, XPathContext context, int locationId) throws XPathException
context
- The dynamic context, giving access to the current node,
the current variables, etc.XPathException
- if an error occurs (for example if the value is
a closure that needs to be evaluated)Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.