Package net.sf.saxon.value
Class ShareableSequence
java.lang.Object
net.sf.saxon.value.Value
net.sf.saxon.value.ShareableSequence
- All Implemented Interfaces:
Serializable
,Expression
,ValueRepresentation
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.
- See Also:
-
Field Summary
Fields inherited from class net.sf.saxon.value.Value
EMPTY_CLASS_ARRAY
Fields inherited from interface net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
effectiveBooleanValue
(XPathContext context) Get the effective boolean valueint
Determine the cardinalityint
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().Get the (lowest common) item typeint
Get the number of items in the sequencegetList()
Get the underlying listboolean
Determine whether another value can share this list.itemAt
(int n) Get the n'th item in the sequence (starting with 0 as the first item)iterate
(XPathContext context) Return an iterator over this sequence.reduce()
Reduce a value to its simplest form.simplify()
Simplify this valueMethods inherited from class net.sf.saxon.value.Value
asItem, asIterator, asValue, checkPermittedContents, convert, convertJavaObjectToXPath, convertToJava, display, equals, evaluateAsString, evaluateItem, getDependencies, getIterator, getParentExpression, getSpecialProperties, getStringValue, getStringValueCS, hashCode, iterateSubExpressions, makeQNameValue, optimize, process, promote, simplify, stringToNumber, toString, typeCheck
-
Constructor Details
-
ShareableSequence
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)- Parameters:
list
- the list of items to be included in the sequence
-
-
Method Details
-
getList
Get the underlying list -
getImplementationMethod
public int getImplementationMethod()An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is preferred. -
simplify
Simplify this 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 -
getLength
public int getLength()Get the number of items in the sequence -
getCardinality
public int getCardinality()Determine the cardinality- Specified by:
getCardinality
in interfaceExpression
- Overrides:
getCardinality
in classValue
- Returns:
- the cardinality of the sequence, using the constants defined in net.sf.saxon.value.Cardinality
- See Also:
-
getItemType
Get the (lowest common) item type- Specified by:
getItemType
in interfaceExpression
- Overrides:
getItemType
in classValue
- Parameters:
th
-- Returns:
- integer identifying an item type to which all the items in this sequence conform
-
itemAt
Get the n'th item in the sequence (starting with 0 as the first item) -
iterate
Return an iterator over this sequence.- Parameters:
context
- dynamic evaluation context; not used in this implementation of the method- Returns:
- the required SequenceIterator, positioned at the start of the sequence
-
effectiveBooleanValue
Get the effective boolean value- Specified by:
effectiveBooleanValue
in interfaceExpression
- Overrides:
effectiveBooleanValue
in classValue
- Parameters:
context
- The context in which the expression is to be evaluated- Returns:
- the effective boolean value
- Throws:
XPathException
- if any dynamic error occurs evaluating the expression