net.sf.saxon.value
Class ShareableSequence
- Serializable, SequenceIterable, ValueRepresentation
public final class ShareableSequence
A sequence value implemented extensionally using an extensible List whose leading part can be shared
with other sequence values. The list can be appended to by other users (at most one other user!),
but the items within the range used by this sequence value cannot be modified.
asItem , asItem , asIterator , asValue , checkPermittedContents , convertJavaObjectToXPath , convertToJava , convertToJava , effectiveBooleanValue , equals , fromItem , getCanonicalLexicalRepresentation , getCardinality , getItemType , getIterator , getLength , getSchemaComparable , getStringValue , getStringValueCS , itemAt , iterate , iterate , makeQNameValue , process , reduce , stringToNumber , toString |
ShareableSequence
public ShareableSequence(List list)
Construct an sequence from an array of items. Note, the list of items is used as is,
which means the caller must not subsequently change its contents; however it is permitted
to subsequently append items to the list (indeed, that is the raison d'etre of this class)
list
- the list of items to be included in the sequence
getCardinality
public int getCardinality()
Determine the cardinality
- getCardinality in interface Value
- the cardinality of the sequence, using the constants defined in
net.sf.saxon.value.Cardinality
getItemType
public ItemType getItemType(TypeHierarchy th)
Get the (lowest common) item type
- getItemType in interface Value
th
- the type hierarchy cache
- integer identifying an item type to which all the items in this
sequence conform
getLength
public int getLength()
Get the number of items in the sequence
- getLength in interface Value
- the number of items in the sequence
getList
public List getList()
Get the underlying list
- the underlying list of values
isShareable
public boolean isShareable()
Determine whether another value can share this list. This is true provided the list has
not already been extended by another value.
- true if another value can share this list
itemAt
public Item itemAt(int n)
Get the n'th item in the sequence (starting with 0 as the first item)
- itemAt in interface Value
n
- the position of the required item
- the n'th item in the sequence
iterate
public SequenceIterator iterate()
Return an iterator over this sequence.
- iterate in interface Value
- the required SequenceIterator, positioned at the start of the
sequence
reduce
public Value reduce()
Reduce a value to its simplest form. If the value is a closure or some other form of deferred value
such as a FunctionCallPackage, then it is reduced to a SequenceExtent. If it is a SequenceExtent containing
a single item, then it is reduced to that item. One consequence that is exploited by class FilterExpression
is that if the value is a singleton numeric value, then the result will be an instance of NumericValue
- reduce in interface Value
simplify
public Value simplify()
Simplify this value