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
-
-
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 SimpleStepExpressioncopy(RebindingMap rebindings)Copy an expression.AxisExpressiongetAxisExpression()java.lang.StringgetExpressionName()Get a name identifying the kind of expression, in terms meaningful to a user.intgetImplementationMethod()An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().protected OperandRolegetOperandRole(int arg)Get the operand roleSequenceIteratoriterate(XPathContext context)Evaluate the expression, returning an iterator over the resultExpressionoptimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType)Perform optimisation of an expression and its subexpressions.ExpressiontypeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)Type-check the expression-
Methods inherited from class net.sf.saxon.expr.SlashExpression
addToPathMap, computeCardinality, computeHashCode, computeSpecialProperties, equals, export, getActionExpression, getCost, getFirstStep, getIntegerBounds, getItemType, getLastStep, getLeadingSteps, getRemainingSteps, getSelectExpression, getStart, getStaticUType, getStep, getStreamerName, isAbsolute, isContextFree, promoteFocusIndependentSubexpressions, 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, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getDependencies, getEvaluationMethod, getExtraProperty, getInterpretedExpression, 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, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, typeCheckChildren, typeError, verifyParentPointers
-
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
-
getOperandRole
protected OperandRole getOperandRole(int arg)
Description copied from class:BinaryExpressionGet the operand role- Overrides:
getOperandRolein classSlashExpression- Parameters:
arg- which argument: 0 for the lhs, 1 for the rhs- Returns:
- the operand role
-
getAxisExpression
public AxisExpression getAxisExpression()
-
typeCheck
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Description copied from class:SlashExpressionType-check the expression- Overrides:
typeCheckin 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:BinaryExpressionPerform 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:
optimizein 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:
copyin classSlashExpression- Parameters:
rebindings-- 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:
getImplementationMethodin classSlashExpression- Returns:
- the implementation method, for example
Expression.ITERATE_METHODorExpression.EVALUATE_METHODorExpression.PROCESS_METHOD
-
iterate
public SequenceIterator iterate(XPathContext context) throws XPathException
Evaluate the expression, returning an iterator over the result- Overrides:
iteratein 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:ExpressionGet a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionNamein 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.
-
-