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_COST, 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 |
computeHashCode()
get HashCode for comparing two expressions
|
int |
computeSpecialProperties()
Get the static properties of this expression (other than its type).
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
boolean |
equals(java.lang.Object other)
Is this expression the same as another expression?
|
void |
export(ExpressionPresenter destination)
Diagnostic print of expression structure.
|
byte |
getAxis()
Get the axis
|
ContextItemStaticInfo |
getContextItemStaticInfo() |
ItemType |
getContextItemType()
Get the static type of the context item for this AxisExpression.
|
double |
getCost()
Return the estimated cost of evaluating an expression.
|
java.lang.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.
|
java.util.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
|
UType |
getStaticUType(UType contextItemType)
Get the static type of the expression as a UType, following precisely the type
inference rules defined in the XSLT 3.0 specification.
|
java.lang.String |
getStreamerName()
Get the (partial) name of a class that supports streaming of this kind of expression
|
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
|
SequenceIterator<?> |
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)
Convert this expression to an equivalent XSLT pattern
|
java.lang.String |
toShortString()
Produce a short string identifying the expression for use in error messages
|
java.lang.String |
toString()
Represent the expression as a string.
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression
|
adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operands, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, typeCheckChildren, typeError, unordered, verifyParentPointers
public AxisExpression(byte axis, NodeTest nodeTest)
public void setAxis(byte axis)
axis
- the new axispublic java.lang.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 double getCost()
getCost
in class Expression
public boolean equals(java.lang.Object other)
equals
in class Expression
other
- the other operand; the result is false if this is not an Expressionpublic int computeHashCode()
computeHashCode
in class Expression
public Expression copy(RebindingMap rebindings)
copy
in class Expression
rebindings
- a mutable list of (old binding, new binding) pairs
that is used to update the bindings held in any
local variable references that are copied.public int computeSpecialProperties()
computeSpecialProperties
in class Expression
public final ItemType getItemType()
getItemType
in class Expression
public UType getStaticUType(UType contextItemType)
getStaticUType
in class Expression
contextItemType
- the static type of the context item for the expression evaluationpublic 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
. May also return StaticProperty.ALLOWS_ZERO
if
the result is known to be an empty sequence, or StaticProperty.ALLOWS_MANY
if
if is known to return a sequence of length two 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 ContextItemStaticInfo getContextItemStaticInfo()
public Pattern toPattern(Configuration config) throws XPathException
toPattern
in class Expression
config
- the Saxon configurationXPathException
- if conversion is not possiblepublic int getImplementationMethod()
Expression
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public SequenceIterator<?> 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 void export(ExpressionPresenter destination) throws XPathException
export
in interface ExportAgent
export
in class Expression
destination
- the expression presenter used to display the structureXPathException
- if the export fails, for example if an expression is found that won't work
in the target environment.public java.lang.String toString()
toString
in class Expression
public java.lang.String toShortString()
Expression
toShortString
in class Expression
public java.lang.String getStreamerName()
Expression
getStreamerName
in class Expression
public java.util.Set<Expression> getPreconditions()
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.