public final class AxisExpression extends Expression
An AxisExpression delivers nodes in axis order (not in document order). To get nodes in document order, in the case of a reverse axis, the expression should be wrapped in a call on reverse().
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
Constructor and Description |
---|
AxisExpression(byte axis,
NodeTest nodeTest)
Constructor for an AxisExpression whose origin is the context item
|
Modifier and Type | Method and Description |
---|---|
PathMap.PathMapNodeSet |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap.
|
int |
computeCardinality()
Determine the cardinality of the result of this expression
|
int |
computeSpecialProperties()
Get the static properties of this expression (other than its type).
|
Expression |
copy()
Copy an expression.
|
boolean |
equals(Object other)
Is this expression the same as another expression?
|
void |
export(ExpressionPresenter destination)
Diagnostic print of expression structure.
|
byte |
getAxis()
Get the axis
|
ItemType |
getContextItemType()
Get the static type of the context item for this AxisExpression.
|
int |
getCost()
Return the estimated cost of evaluating an expression.
|
ExpressionCompiler |
getExpressionCompiler()
Return the compiler of the Axis expression
|
String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
int |
getIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived
from the dependencies of its subexpressions.
|
ItemType |
getItemType()
Determine the data type of the items returned by this expression
|
NodeTest |
getNodeTest()
Get the NodeTest.
|
Set<Expression> |
getPreconditions()
Find any necessary preconditions for the satisfaction of this expression
as a set of boolean expressions to be evaluated on the context node
|
protected StreamingAdjunct |
getStreamingAdjunct()
Get a class that supports streamed evaluation of this expression
|
int |
hashCode()
get HashCode for comparing two expressions
|
boolean |
isContextPossiblyUndefined()
Ask whether there is a possibility that the context item will be undefined
|
boolean |
isSubtreeExpression()
Determine whether the expression can be evaluated without reference to the part of the context
document outside the subtree rooted at the context node.
|
AxisIterator |
iterate(NodeInfo origin)
Iterate the axis from a given starting node, without regard to context
|
AxisIterator |
iterate(XPathContext context)
Evaluate the path-expression in a given context to return a NodeSet
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Perform optimisation of an expression and its subexpressions.
|
void |
setAxis(byte axis)
Set the axis
|
Expression |
simplify()
Simplify an expression
|
Pattern |
toPattern(Configuration config,
boolean is30)
Convert this expression to an equivalent XSLT pattern
|
String |
toShortString()
Produce a short string identifying the expression for use in error messages
|
String |
toString()
Represent the expression as a string.
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression
|
adoptChildExpression, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, clearStreamabilityData, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getDependencies, getEvaluationMethod, getHostLanguage, getIntegerBounds, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getPosture, getPostureAndSweepIfKnown, getProperties, getProperty, getRetainedStaticContext, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStreamability, getSweep, getSystemId, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isUpdatingExpression, isVacuousExpression, iterateEvents, makeStreamingAdjunct, markTailFunctionCalls, operandList, operands, operandSparseList, optimizeChildren, optimizeForType, process, promote, promoteChildren, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setFiltered, setFlattened, setLocation, setParentExpression, setPostureAndSweep, setRetainedStaticContext, setRetainedStaticContextLocally, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, toStreamingPattern, typeCheckChildren, typeError, unordered
public AxisExpression(byte axis, NodeTest nodeTest)
public void setAxis(byte axis)
axis
- the new axispublic String getExpressionName()
getExpressionName
in class Expression
public Expression simplify() throws XPathException
simplify
in class Expression
XPathException
- if an error is discovered during expression
rewritingpublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
typeCheck
in class Expression
visitor
- an expression visitorcontextInfo
- Information available statically about the context item: whether it is (possibly)
absent; its static type; its streaming posture.XPathException
- if an error is discovered during this phase
(typically a type error)public ItemType getContextItemType()
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
optimize
in class Expression
visitor
- an expression visitorcontextInfo
- the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPE
public int getCost()
getCost
in class Expression
public boolean equals(Object other)
public int hashCode()
public Expression copy()
copy
in class Expression
public int computeSpecialProperties()
computeSpecialProperties
in class Expression
public final ItemType getItemType()
getItemType
in class Expression
public int getIntrinsicDependencies()
getIntrinsicDependencies
in class Expression
public final int computeCardinality()
computeCardinality
in class Expression
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
public boolean isSubtreeExpression()
isSubtreeExpression
in class Expression
public byte getAxis()
AxisInfo.CHILD
public NodeTest getNodeTest()
public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
addToPathMap
in class Expression
pathMap
- the PathMap to which the expression should be addedpathMapNodeSet
- the PathMapNodeSet to which the paths embodied in this expression should be addedpublic boolean isContextPossiblyUndefined()
public Pattern toPattern(Configuration config, boolean is30) throws XPathException
toPattern
in class Expression
config
- the Saxon configurationis30
- true if this is XSLT 3.0XPathException
- if conversion is not possiblepublic int getImplementationMethod()
Expression
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public AxisIterator iterate(XPathContext context) throws XPathException
iterate
in class Expression
context
- the evaluation contextXPathException
- if any dynamic error occurs evaluating the
expressionpublic AxisIterator iterate(NodeInfo origin)
origin
- the starting nodepublic ExpressionCompiler getExpressionCompiler()
getExpressionCompiler
in class Expression
public void export(ExpressionPresenter destination)
export
in class Expression
destination
- the expression presenter used to display the structurepublic String toString()
toString
in class Expression
public String toShortString()
Expression
toShortString
in class Expression
protected StreamingAdjunct getStreamingAdjunct()
getStreamingAdjunct
in class Expression
public Set<Expression> getPreconditions()
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.