com.icl.saxon.expr
Class NodeSetValue
public abstract class NodeSetValue
A node-set value. We use this both for node-sets and node-lists. The node set will only
be sorted into document order when requested (using sort() or evaluate()). This is an abstract
class with a number of concrete implementations including NodeSetExtent (for extensional node-sets)
and NodeSetIntent (for intensional node-sets).
asBoolean , asNumber , asString , compare , conversionPreference , convertToJava , equals , evaluate , getDependencies , inverse , notEquals , numericCompare , reduce , simplify , stringToNumber |
containsReferences , display , enumerate , evaluate , evaluateAsBoolean , evaluateAsNodeSet , evaluateAsNumber , evaluateAsString , getDataType , getDependencies , getStaticContext , indent , isContextDocumentNodeSet , make , outputStringValue , reduce , setStaticContext , simplify , usesCurrent |
asBoolean
public abstract boolean asBoolean()
throws XPathException
Evaluate as a boolean.
- asBoolean in interface Value
- true if the node set is not empty
asNumber
public double asNumber()
throws XPathException
Evaluate as a number.
- asNumber in interface Value
- the number obtained by evaluating as a String and converting the string to a number
asString
public abstract String asString()
throws XPathException
Convert to string value
- asString in interface Value
- the value of the first node in the node-set if there
is one, otherwise an empty string
compare
public boolean compare(int operator,
Value other)
throws XPathException
Test how a nodeset compares to another Value under a relational comparison
- compare in interface Value
operator
- The comparison operator, one of Tokenizer.LE, Tokenizer.LT,
Tokenizer.GE, Tokenizer.GT,
conversionPreference
public int conversionPreference(Class required)
Get conversion preference for this value to a Java class. A low result
indicates higher preference.
- conversionPreference in interface Value
convertToJava
public Object convertToJava(Class target)
throws XPathException
Convert to Java object (for passing to external functions)
- convertToJava in interface Value
display
public void display(int level)
Diagnostic print of expression structure
- display in interface Expression
enumerate
public abstract NodeEnumeration enumerate()
throws XPathException
Return an enumeration of this nodeset value. Unless sort() has been called
the nodes can be in any order.
enumerate
public NodeEnumeration enumerate(Context c,
boolean sorted)
throws XPathException
Return an enumeration of this nodeset value. This is to satisfy the interface for
Expression.
- enumerate in interface Expression
sorted
- Indicates that the result must be in document order
evaluate
public Value evaluate(Context context)
throws XPathException
Evaluate the Node Set. This guarantees to return the result in sorted order.
- evaluate in interface Value
context
- The context for evaluation (not used)
getCount
public abstract int getCount()
throws XPathException
Count the nodes in the node-set. Note this will sort the node set if necessary, to
make sure there are no duplicates.
getDataType
public int getDataType()
Determine the data type of the expression
- getDataType in interface Expression
getFirst
public abstract NodeInfo getFirst()
throws XPathException
Get the first node in the nodeset (in document order)
isSorted
public abstract boolean isSorted()
throws XPathException
Test whether the value is known to be sorted
- true if the value is known to be sorted in document order, false if it is not
known whether it is sorted.
setSorted
public abstract void setSorted(boolean isSorted)
Set a flag to indicate whether the nodes are sorted. Used when the creator of the
node-set knows that they are already in document order.
isSorted
- true if the caller wishes to assert that the nodes are in document order
and do not need to be further sorted
sort
public abstract NodeSetValue sort()
throws XPathException
Sort the nodes into document order.
This does nothing if the nodes are already known to be sorted; to force a sort,
call setSorted(false)
- the same NodeSetValue, after sorting. (The reason for returning this is that
it makes life easier for the XSL compiler).