Package net.sf.saxon.expr
Class SimpleStepExpression
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.BinaryExpression
-
- net.sf.saxon.expr.SlashExpression
-
- net.sf.saxon.expr.SimpleStepExpression
-
- All Implemented Interfaces:
ContextOriginator
,ContextSwitchingExpression
,ExportAgent
,Locatable
,IdentityComparable
,Traceable
public final class SimpleStepExpression extends SlashExpression
A SimpleStepExpression is a special case of a SlashExpression in which the start expression selects a single item (or nothing), and the step expression is a simple AxisExpression. This is designed to avoid the costs of creating a new dynamic context for expressions (common in XQuery) such as for $b in EXPR return $b/title
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SimpleStepExpression.SimpleStepExprElaborator
Elaborator for a simple step expression, that is X/axis::Y where X evaluates to a singleton-
Nested classes/interfaces inherited from class net.sf.saxon.expr.SlashExpression
SlashExpression.SlashExprElaborator
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.BinaryExpression
operator
-
Fields inherited from class net.sf.saxon.expr.Expression
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 Summary
Constructors Constructor Description SimpleStepExpression(Expression start, Expression step)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleStepExpression
copy(RebindingMap rebindings)
Copy an expression.AxisExpression
getAxisExpression()
Elaborator
getElaborator()
Make an elaborator for this expressionjava.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().protected OperandRole
getOperandRole(int arg)
Get the operand roleSequenceIterator
iterate(XPathContext context)
Evaluate the expression, returning an iterator over the resultExpression
optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.Expression
typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)
Type-check the expression-
Methods inherited from class net.sf.saxon.expr.SlashExpression
addToPathMap, computeCardinality, computeHashCode, computeSpecialProperties, disableIndexing, equals, export, getActionExpression, getCost, getFirstStep, getIntegerBounds, getItemType, getLastStep, getLeadingSteps, getRemainingSteps, getSelectExpression, getStart, getStaticUType, getStep, getStreamerName, isAbsolute, isContextFree, setContextFree, setStart, setStep, simplifyDescendantPath, toPattern, toShortString, toString, tryToMakeAbsolute, tryToMakeSorted, unordered
-
Methods inherited from class net.sf.saxon.expr.BinaryExpression
displayOperator, explainExtraAttributes, getLhs, getLhsExpression, getOperator, getRhs, getRhsExpression, isAssociative, isCommutative, isInverse, operands, setFlattened, setLhsExpression, setRhsExpression, tag
-
Methods inherited from class net.sf.saxon.expr.Expression
adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dispatchTailCall, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, explain, getCardinality, getConfiguration, getDependencies, getEvaluationMethod, getExtraProperty, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, typeCheckChildren, typeError, verifyParentPointers, withLocation
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
-
-
-
Constructor Detail
-
SimpleStepExpression
public SimpleStepExpression(Expression start, Expression step)
-
-
Method Detail
-
getAxisExpression
public AxisExpression getAxisExpression()
-
getOperandRole
protected OperandRole getOperandRole(int arg)
Description copied from class:BinaryExpression
Get the operand role- Overrides:
getOperandRole
in classSlashExpression
- Parameters:
arg
- which argument: 0 for the lhs, 1 for the rhs- Returns:
- the operand role
-
typeCheck
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Description copied from class:SlashExpression
Type-check the expression- Overrides:
typeCheck
in classSlashExpression
- Parameters:
visitor
- an expression visitorcontextInfo
- Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.- Returns:
- the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
- Throws:
XPathException
- if an error is discovered during this phase (typically a type error)
-
optimize
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
Description copied from class:BinaryExpression
Perform optimisation of an expression and its subexpressions.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.
- Overrides:
optimize
in classSlashExpression
- Parameters:
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 toType.ITEM_TYPE
- Returns:
- the original expression, rewritten if appropriate to optimize execution
- Throws:
XPathException
- if an error is discovered during this phase (typically a type error)
-
copy
public SimpleStepExpression copy(RebindingMap rebindings)
Copy an expression. This makes a deep copy.- Overrides:
copy
in classSlashExpression
- Parameters:
rebindings
- variables that need to be re-bound- Returns:
- the copy of the original expression
-
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 provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.- Overrides:
getImplementationMethod
in classSlashExpression
- Returns:
- the implementation method, for example
Expression.ITERATE_METHOD
orExpression.EVALUATE_METHOD
orExpression.PROCESS_METHOD
-
iterate
public SequenceIterator iterate(XPathContext context) throws XPathException
Evaluate the expression, returning an iterator over the result- Overrides:
iterate
in classSlashExpression
- Parameters:
context
- the evaluation context- Returns:
- a SequenceIterator that can be used to iterate over the result of the expression
- Throws:
XPathException
- if any dynamic error occurs evaluating the expression
-
getExpressionName
public java.lang.String getExpressionName()
Description copied from class:Expression
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionName
in classSlashExpression
- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in export() output displaying the expression.
-
getElaborator
public Elaborator getElaborator()
Make an elaborator for this expression- Overrides:
getElaborator
in classSlashExpression
- Returns:
- a suitable elaborator
-
-