|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.expr.Expression net.sf.saxon.expr.Assignation
public abstract class Assignation
Assignation is an abstract superclass for the kinds of expression that declare range variables: for, some, and every.
Field Summary | |
---|---|
protected Expression |
action
|
protected SequenceType |
requiredType
|
protected Expression |
sequence
|
protected int |
slotNumber
|
protected StructuredQName |
variableName
|
Fields inherited from class net.sf.saxon.expr.Expression |
---|
EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, PUSH_SELECTION, staticProperties, WATCH_METHOD |
Constructor Summary | |
---|---|
Assignation()
|
Method Summary | |
---|---|
void |
addReference(boolean isLoopingReference)
Register a variable reference that refers to the variable bound in this expression |
PathMap.PathMapNodeSet |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap. |
void |
checkForUpdatingSubexpressions()
Check to ensure that this expression does not contain any inappropriate updating subexpressions. |
ValueRepresentation |
evaluateVariable(XPathContext context)
Get the value of the range variable |
Binding[] |
extendBindingList(Binding[] in)
Extend an array of variable bindings to include the binding(s) defined in this expression |
Expression |
getAction()
Get the action expression |
int |
getLocalSlotNumber()
If this is a local variable held on the local stack frame, return the corresponding slot number. |
int |
getNominalReferenceCount()
Get the (nominal) count of the number of references to this variable |
StructuredQName |
getObjectName()
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. |
int |
getRequiredSlots()
Get the number of slots required. |
SequenceType |
getRequiredType()
Get the declared type of the variable |
Expression |
getSequence()
Get the "sequence" expression - the one to which the variable is bound |
String |
getVariableName()
Get the display name of the range variable, for diagnostics only |
StructuredQName |
getVariableQName()
Get the name of the variable |
boolean |
isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign extension element. |
boolean |
isGlobal()
Indicate whether the binding is local or global. |
boolean |
isIndexedVariable()
Test whether the variable bound by this let expression should be indexable |
boolean |
isUpdatingExpression()
Determine whether this is an updating expression as defined in the XQuery update specification |
Iterator<Expression> |
iterateSubExpressions()
Get the immediate subexpressions of this expression |
Expression |
promote(PromotionOffer offer,
Expression parent)
Promote this expression if possible |
protected Expression |
promoteWhereClause(Binding positionBinding)
Promote a WHERE clause whose condition doesn't depend on the variable being bound. |
void |
refineTypeInformation(ItemType type,
int cardinality,
Value constantValue,
int properties,
ExpressionVisitor visitor,
Assignation currentExpression)
Refine the type information associated with this variable declaration. |
boolean |
replaceSubExpression(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression |
void |
replaceVariable(Optimizer opt,
Expression seq)
Replace all references to the variable bound by this let expression, that occur within the action expression, with the given expression |
void |
setAction(Expression action)
Add the "return" or "satisfies" expression, and fix up all references to the range variable that occur within that expression |
void |
setIndexedVariable()
Indicate that the variable bound by this let expression should be indexable (because it is used in an appropriate filter expression) |
void |
setRequiredType(SequenceType requiredType)
Set the required type (declared type) of the variable |
void |
setSequence(Expression sequence)
Set the "sequence" expression - the one to which the variable is bound |
void |
setSlotNumber(int nr)
Set the slot number for the range variable |
void |
setVariableQName(StructuredQName variableName)
Set the name of the variable |
Expression |
simplify(ExpressionVisitor visitor)
Simplify the expression |
void |
suppressValidation(int validationMode)
Suppress validation on contained element constructors, on the grounds that the parent element is already performing validation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int slotNumber
protected Expression sequence
protected Expression action
protected StructuredQName variableName
protected SequenceType requiredType
Constructor Detail |
---|
public Assignation()
Method Detail |
---|
public void setRequiredType(SequenceType requiredType)
requiredType
- the required typepublic void setVariableQName(StructuredQName variableName)
variableName
- the name of the variablepublic StructuredQName getVariableQName()
getVariableQName
in interface Binding
public StructuredQName getObjectName()
InstructionInfo
getObjectName
in interface InstructionInfo
getObjectName
in class Expression
public SequenceType getRequiredType()
getRequiredType
in interface Binding
public int getLocalSlotNumber()
getLocalSlotNumber
in interface Binding
public ValueRepresentation evaluateVariable(XPathContext context) throws XPathException
evaluateVariable
in interface Binding
context
- the XPath dynamic evaluation context
XPathException
public void setAction(Expression action)
action
- the expression that occurs after the "return" keyword of a "for"
expression, the "satisfies" keyword of "some/every", or the ":=" operator of
a "let" expression.public final boolean isGlobal()
isGlobal
in interface Binding
public final boolean isAssignable()
isAssignable
in interface Binding
public void checkForUpdatingSubexpressions() throws XPathException
checkForUpdatingSubexpressions
in class Expression
XPathException
- if the expression has a non-permitted updateing subexpressionpublic boolean isUpdatingExpression()
isUpdatingExpression
in class Expression
public Expression getAction()
public void setSequence(Expression sequence)
sequence
- the expression to which the variable is boundpublic Expression getSequence()
public void setSlotNumber(int nr)
nr
- the slot number to be usedpublic int getRequiredSlots()
public Expression simplify(ExpressionVisitor visitor) throws XPathException
simplify
in class Expression
visitor
- an expression visitor
XPathException
- if an error is discovered during expression
rewritingpublic Expression promote(PromotionOffer offer, Expression parent) throws XPathException
promote
in class Expression
offer
- details of the offer, for example the offer to move
expressions that don't depend on the context to an outer level in
the containing expression
XPathException
- if any error is detectedpublic void suppressValidation(int validationMode)
suppressValidation
in class Expression
validationMode
- the kind of validation being performed on the parent expressionpublic Binding[] extendBindingList(Binding[] in)
in
- a set of variable bindings
protected Expression promoteWhereClause(Binding positionBinding)
let $i := SEQ return if (C) then R else ()
to the form:
if (C) then (let $i := SEQ return R) else ()
positionBinding
- the binding of the position variable if any
public Iterator<Expression> iterateSubExpressions()
iterateSubExpressions
in class Expression
public boolean replaceSubExpression(Expression original, Expression replacement)
replaceSubExpression
in class Expression
original
- the original subexpressionreplacement
- the replacement subexpression
public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
The default implementation of this method assumes that an expression does no navigation other than the navigation done by evaluating its subexpressions, and that the subexpressions are evaluated in the same context as the containing expression. The method must be overridden for any expression where these assumptions do not hold. For example, implementations exist for AxisExpression, ParentExpression, and RootExpression (because they perform navigation), and for the doc(), document(), and collection() functions because they create a new navigation root. Implementations also exist for PathExpression and FilterExpression because they have subexpressions that are evaluated in a different context from the calling expression.
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 added
public String getVariableName()
public void refineTypeInformation(ItemType type, int cardinality, Value constantValue, int properties, ExpressionVisitor visitor, Assignation currentExpression)
type
- the inferred item type of the expression to which the variable is boundcardinality
- the inferred cardinality of the expression to which the variable is boundconstantValue
- the constant value to which the variable is bound (null if there is no constant value)properties
- other static properties of the expression to which the variable is boundvisitor
- an expression visitor to provide context informationcurrentExpression
- the expression that binds the variablepublic void addReference(boolean isLoopingReference)
isLoopingReference
- - true if the reference occurs within a loop, such as the predicate
of a filter expressionpublic int getNominalReferenceCount()
public boolean isIndexedVariable()
public void replaceVariable(Optimizer opt, Expression seq) throws XPathException
opt
- The optimizerseq
- the expression
XPathException
public void setIndexedVariable()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |