net.sf.saxon.expr

Class QuantifiedExpression

public class QuantifiedExpression extends Assignation

A QuantifiedExpression tests whether some/all items in a sequence satisfy some condition.
Method Summary
voidcheckForUpdatingSubexpressions()
Check to ensure that this expression does not contain any updating subexpressions.
intcomputeCardinality()
Determine the static cardinality
intcomputeSpecialProperties()
Determine the special properties of this expression
Expressioncopy()
Copy an expression.
booleaneffectiveBooleanValue(XPathContext context)
Get the result as a boolean
ItemevaluateItem(XPathContext context)
Evaluate the expression to return a singleton value
voidexplain(ExpressionPresenter out)
Diagnostic print of expression structure.
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression
intgetOperator()
Get the operator, either SOME or
booleanhasLoopingSubexpression(Expression child)
Given an expression that is an immediate child of this expression, test whether the evaluation of the parent expression causes the child expression to be evaluated repeatedly
booleanisUpdatingExpression()
Determine whether this is an updating expression as defined in the XQuery update specification
Expressionoptimize(ExpressionVisitor visitor, ItemType contextItemType)
Perform optimisation of an expression and its subexpressions.
voidsetOperator(int operator)
Set the operator, either SOME or
StringtoString()
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.
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

Method Detail

checkForUpdatingSubexpressions

public void checkForUpdatingSubexpressions()
Check to ensure that this expression does not contain any updating subexpressions. This check is overridden for those expressions that permit updating subexpressions.

Throws: net.sf.saxon.trans.XPathException if the expression has a non-permitted updateing subexpression

computeCardinality

public int computeCardinality()
Determine the static cardinality

computeSpecialProperties

public int computeSpecialProperties()
Determine the special properties of this expression

Returns: NON_CREATIVE.

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

effectiveBooleanValue

public boolean effectiveBooleanValue(XPathContext context)
Get the result as a boolean

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate the expression to return a singleton value

explain

public void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression

Parameters: th the type hierarchy cache

Returns: Type.BOOLEAN

getOperator

public int getOperator()
Get the operator, either SOME or EVERY

Returns: the operator

hasLoopingSubexpression

public boolean hasLoopingSubexpression(Expression child)
Given an expression that is an immediate child of this expression, test whether the evaluation of the parent expression causes the child expression to be evaluated repeatedly

Parameters: child the immediate subexpression

Returns: true if the child expression is evaluated repeatedly

isUpdatingExpression

public boolean isUpdatingExpression()
Determine whether this is an updating expression as defined in the XQuery update specification

Returns: true if this is an updating expression

optimize

public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType)
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.

Parameters: visitor an expression visitor contextItemType 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 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)

setOperator

public void setOperator(int operator)
Set the operator, either SOME or EVERY

Parameters: operator the operator

toString

public 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. In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax

Returns: a representation of the expression as a string

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression