Package net.sf.saxon.expr
Class Operand
java.lang.Object
net.sf.saxon.expr.Operand
- All Implemented Interfaces:
Iterable<Operand>
,ExpressionOwner
Information about a sub-expression and its relationship to the parent expression
-
Constructor Summary
ConstructorsConstructorDescriptionOperand
(Expression parentExpression, Expression childExpression, OperandRole role) Create an operand object -
Method Summary
Modifier and TypeMethodDescriptionvoid
Get the expression used as the actual operandGet the operand roleGet the parent expression of this operandGet the required type of the operandgetUsage()
Get the usage of the operandboolean
Ask whether the child expression is evaluated with the same focus as its parent expressionboolean
boolean
Ask whether the operand is is evaluated repeatedly during a single evaluation of the parent expression.boolean
Ask whether the operand is a higher-order operand,: typically this means that the child expression is evaluated repeatedly during a single evaluation of the parent expression (but there are some cases like xsl:for-each select=".." where the operand is higher-order despite not being evaluated repeatedly).boolean
Ask whether the operand is a member of a choice groupiterator()
Get a singleton iterator that returns this operand onlyvoid
optimize
(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Perform optimization on the child expression.void
setChildExpression
(Expression childExpression) Change the child expression used for this operand.void
setOperandRole
(OperandRole role) Set the operand roleboolean
Ask whether the child expression sets a new focus for evaluation of other operandsvoid
setUsage
(OperandUsage usage) Set the usage of the operandvoid
typeCheck
(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Perform type-checking on the child expression.static OperandUsage
typeDeterminedUsage
(ItemType type) Get the type-determined usage of the operand, as defined in the XSLT 3.0 streaming specMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Operand
Create an operand object- Parameters:
parentExpression
- the expression of which this is an operandchildExpression
- the actual expression used as the operandrole
- information about the role this operand plays within the parent expression
-
-
Method Details
-
getParentExpression
Get the parent expression of this operand- Returns:
- the parent expression
-
getChildExpression
Get the expression used as the actual operand- Specified by:
getChildExpression
in interfaceExpressionOwner
- Returns:
- the child expression
-
setChildExpression
Change the child expression used for this operand. This is the only approved way of making structural changes to the expression tree, and the implementation of this method is responsible for maintaining the consistency of the tree- Specified by:
setChildExpression
in interfaceExpressionOwner
- Parameters:
childExpression
- the new child expression
-
detachChild
public void detachChild() -
getOperandRole
Get the operand role- Returns:
- the operand role
-
setOperandRole
Set the operand role- Parameters:
role
- the operand role
-
setsNewFocus
public boolean setsNewFocus()Ask whether the child expression sets a new focus for evaluation of other operands- Returns:
- true if the child expression is evaluated with the same focus as its parent expression
-
hasSpecialFocusRules
public boolean hasSpecialFocusRules() -
hasSameFocus
public boolean hasSameFocus()Ask whether the child expression is evaluated with the same focus as its parent expression- Returns:
- true if the child expression is evaluated with the same focus as its parent expression
-
isHigherOrder
public boolean isHigherOrder()Ask whether the operand is a higher-order operand,: typically this means that the child expression is evaluated repeatedly during a single evaluation of the parent expression (but there are some cases like xsl:for-each select=".." where the operand is higher-order despite not being evaluated repeatedly).- Returns:
- true if the operand is higher-order
-
isEvaluatedRepeatedly
public boolean isEvaluatedRepeatedly()Ask whether the operand is is evaluated repeatedly during a single evaluation of the parent expression. This is true if the operand is higher-order and the operand does not have theOperandRole.SINGLETON
property.- Returns:
- true if the operand is higher-order
-
getUsage
Get the usage of the operand- Returns:
- the usage
-
setUsage
Set the usage of the operand- Parameters:
usage
- the operand usage
-
getRequiredType
Get the required type of the operand- Returns:
- the required type
-
isInChoiceGroup
public boolean isInChoiceGroup()Ask whether the operand is a member of a choice group- Returns:
- true if the operand is in a choice group
-
iterator
Get a singleton iterator that returns this operand only -
typeCheck
public void typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Perform type-checking on the child expression. This may cause the child expression to be replaced with a different child expression.- Parameters:
visitor
- the expression visitorcontextInfo
- information about the static context- Throws:
XPathException
- if type checking fails
-
optimize
public void optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Perform optimization on the child expression. This may cause the child expression to be replaced with a different child expression.- Parameters:
visitor
- the expression visitorcontextInfo
- information about the static context- Throws:
XPathException
- if optimization fails
-
typeDeterminedUsage
Get the type-determined usage of the operand, as defined in the XSLT 3.0 streaming spec- Parameters:
type
- the type required by the context in which the expression appears- Returns:
- the type-determined usage
-