public class SlashExpression extends BinaryExpression implements ContextSwitchingExpression, ContextMappingFunction
operator
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 |
---|
SlashExpression(Expression start,
Expression step)
Constructor
|
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 static cardinality of the expression
|
int |
computeSpecialProperties()
Get the static properties of this expression (other than its type).
|
SlashExpression |
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.
|
Expression |
getActionExpression()
Get the step expression (the right-hand operand)
|
int |
getCost()
Return the estimated cost of evaluating an expression.
|
ExpressionCompiler |
getExpressionCompiler()
Return the compiler of the Slash expression
|
String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
Expression |
getFirstStep()
Get the first step in this expression.
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
IntegerValue[] |
getIntegerBounds()
For an expression that returns an integer or a sequence of integers, get
a lower and upper bound on the values of the integers that may be returned, from
static analysis.
|
ItemType |
getItemType()
Determine the data type of the items returned by this exprssion
|
Expression |
getLastStep()
Get the last step of the path expression
|
Expression |
getLeadingSteps()
Get a path expression consisting of all steps except the last
|
protected OperandRole |
getOperandRole(int arg)
Get the operand role
|
Expression |
getRemainingSteps()
Get all steps after the first.
|
Expression |
getSelectExpression()
Get the start expression (the left-hand operand)
|
Expression |
getStart()
Get the left-hand operand
|
Expression |
getStep()
Get the right-hand operand
|
ForEachAdjunct |
getStreamingAdjunct()
Get a class that supports streamed evaluation of this expression
|
int |
hashCode()
get HashCode for comparing two expressions
|
boolean |
isAbsolute()
Test whether a path expression is an absolute path - that is, a path whose first step selects a
document node
|
SequenceIterator |
iterate(XPathContext context)
Iterate the path-expression in a given context
|
SequenceIterator |
map(XPathContext context)
Mapping function, from a node returned by the start iteration, to a sequence
returned by the child.
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.
|
void |
promoteChildren(PromotionOffer offer)
Promote this expression if possible
|
protected Expression |
promoteFocusIndependentSubexpressions(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
If any subexpressions within the step are not dependent on the focus,
and if they are not "creative" expressions (expressions that can create new nodes), then
promote them: this causes them to be evaluated once, outside the path expression
|
void |
setStart(Expression start)
Set the left-hand operand
|
void |
setStep(Expression step)
Set the right-hand operand
|
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()
The toString() method for an expression attempts to give a representation of the expression
in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath.
|
SlashExpression |
tryToMakeAbsolute()
Test whether a path expression is an absolute path - that is, a path whose first step selects a
document node; if not, see if it can be converted to an absolute path.
|
Expression |
tryToMakeSorted(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType) |
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression
|
Expression |
unordered(boolean retainAllNodes,
boolean forStreaming)
Replace this expression by a simpler expression that delivers the results without regard
to order.
|
displayOperator, explainExtraAttributes, getLhs, getLhsExpression, getOperator, getRhs, getRhsExpression, isAssociative, isCommutative, isInverse, operands, setFlattened, setLhsExpression, setRhsExpression, tag
adoptChildExpression, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, clearStreamabilityData, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getDependencies, getEvaluationMethod, getHostLanguage, getIntrinsicDependencies, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getPosture, getPostureAndSweepIfKnown, getProperties, getProperty, getRetainedStaticContext, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStreamability, getSweep, getSystemId, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterateEvents, makeStreamingAdjunct, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, optimizeForType, process, promote, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setFiltered, setLocation, setParentExpression, setPostureAndSweep, setRetainedStaticContext, setRetainedStaticContextLocally, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toStreamingPattern, typeCheckChildren, typeError
public SlashExpression(Expression start, Expression step)
start
- The left hand operand (which must always select a sequence of nodes).step
- The step to be followed from each node in the start expression to yield a new
sequence; this may return either nodes or atomic values (but not a mixture of the two)protected OperandRole getOperandRole(int arg)
BinaryExpression
getOperandRole
in class BinaryExpression
arg
- which argument: 0 for the lhs, 1 for the rhspublic Expression getStart()
public void setStart(Expression start)
start
- the left-hand operandpublic Expression getStep()
public void setStep(Expression step)
step
- the right-hand operandpublic String getExpressionName()
Expression
getExpressionName
in class Expression
public Expression getSelectExpression()
getSelectExpression
in interface ContextSwitchingExpression
public Expression getActionExpression()
getActionExpression
in interface ContextSwitchingExpression
public final ItemType getItemType()
getItemType
in class Expression
public IntegerValue[] getIntegerBounds()
getIntegerBounds
in class Expression
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
typeCheck
in class BinaryExpression
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 Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
BinaryExpression
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 BinaryExpression
visitor
- an expression visitorcontextItemType
- 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
XPathException
- if an error is discovered during this phase
(typically a type error)public SlashExpression tryToMakeAbsolute()
public int getCost()
getCost
in class Expression
public Expression tryToMakeSorted(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
XPathException
protected Expression promoteFocusIndependentSubexpressions(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
visitor
- the expression visitorcontextItemType
- the type of the context item for evaluating the start expressionXPathException
- if a static error is detectedpublic void promoteChildren(PromotionOffer offer) throws XPathException
promoteChildren
in class Expression
offer
- the promotion offerXPathException
- if any failure occurspublic Expression unordered(boolean retainAllNodes, boolean forStreaming) throws XPathException
unordered
in class Expression
retainAllNodes
- set to true if the result must contain exactly the same nodes as the
original; set to false if the result can eliminate (or introduce) duplicates.forStreaming
- set to true if optimizing for streamingXPathException
- if the rewrite failspublic PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
addToPathMap
in class Expression
pathMap
- the PathMap to which the expression should be addedpathMapNodeSet
- public int getImplementationMethod()
getImplementationMethod
in class BinaryExpression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public SlashExpression copy()
copy
in class Expression
public int computeSpecialProperties()
computeSpecialProperties
in class BinaryExpression
StaticProperty.NON_CREATIVE
. This is overridden
for some subclasses.public int computeCardinality()
computeCardinality
in class BinaryExpression
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
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 boolean equals(Object other)
equals
in class BinaryExpression
public int hashCode()
hashCode
in class BinaryExpression
public SequenceIterator iterate(XPathContext context) throws XPathException
iterate
in class Expression
context
- the evaluation contextXPathException
- if any dynamic error occurs evaluating the
expressionpublic SequenceIterator map(XPathContext context) throws XPathException
map
in interface ContextMappingFunction
context
- The processing context. The item to be mapped is the context item identified
from this context: the values of position() and last() also relate to the set of items being mappedXPathException
- if a dynamic error is detectedpublic void export(ExpressionPresenter destination)
export
in class BinaryExpression
destination
- the output destination for the displayed expression treepublic String toString()
toString
in class BinaryExpression
public String toShortString()
Expression
toShortString
in class BinaryExpression
public Expression getFirstStep()
public Expression getRemainingSteps()
public Expression getLastStep()
public Expression getLeadingSteps()
public boolean isAbsolute()
public ForEachAdjunct getStreamingAdjunct()
getStreamingAdjunct
in class Expression
public ExpressionCompiler getExpressionCompiler()
getExpressionCompiler
in class Expression
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.