public final class FilterExpression extends Expression implements ContextSwitchingExpression
| Modifier and Type | Field and Description |
|---|---|
static OperandRole |
FILTER_PREDICATE |
static int |
FILTERED |
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD| Constructor and Description |
|---|
FilterExpression(Expression base,
Expression filter)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
PathMap.PathMapNodeSet |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap.
|
int |
computeCardinality()
Get the static cardinality of this expression
|
int |
computeDependencies()
Determine which aspects of the context the expression depends on.
|
int |
computeSpecialProperties()
Get the static properties of this expression (other than its type).
|
Expression |
copy()
Copy an expression.
|
boolean |
equals(Object other)
Is this expression the same as another expression?
|
void |
explain(ExpressionPresenter out)
Diagnostic print of expression structure.
|
Expression |
getActionExpression()
Get the subexpression that is evaluated in the new context
|
ExpressionCompiler |
getExpressionCompiler()
Return the compiler of the Filter expression
|
String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
Expression |
getFilter()
Get the filter expression
|
IntegerValue[] |
getIntegerBounds()
For an expression that returns an integer or a sequence of integers, get
a lower and upper bound on the values of the integers that may be returned, from
static analysis.
|
ItemType |
getItemType()
Get the data type of the items returned
|
Expression |
getSelectExpression()
Get the base expression
|
FilterExpressionAdjunct |
getStreamingAdjunct()
Get a class that supports streamed evaluation of this expression
|
int |
hashCode()
get HashCode for comparing two expressions
|
boolean |
isFilterIsPositional() |
boolean |
isIndependentFilter()
Determine whether the filter is independent of the context item and position
|
boolean |
isPositional(TypeHierarchy th)
Determine if the filter is positional
|
static boolean |
isPositionalFilter(Expression exp,
TypeHierarchy th)
Determine whether an expression, when used as a filter, is potentially positional;
that is, where it either contains a call on position() or last(), or where it is capable of returning
a numeric result.
|
boolean |
isSimpleBooleanFilter()
Test if the filter always returns a singleton boolean.
|
SequenceIterator |
iterate(XPathContext context)
Iterate over the results, returning them in the correct order
|
Iterable<Operand> |
operands()
Get the immediate sub-expressions of this expression, with information about the relationship
of each expression to its parent expression.
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.
|
Expression |
promote(PromotionOffer offer,
Expression parent)
Promote this expression if possible
|
boolean |
replaceOperand(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression
|
Expression |
simplify(ExpressionVisitor visitor)
Simplify an expression
|
Pattern |
toPattern(Configuration config,
boolean is30)
Convert this expression to an equivalent XSLT pattern
|
String |
toShortString()
Produce a short string identifying the expression for use in error messages
|
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.
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression
param visitor the expression visitor
|
Expression |
unordered(boolean retainAllNodes,
boolean forStreaming)
Replace this expression by a simpler expression that delivers the results without regard
to order.
|
adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, clearStreamabilityData, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getConfiguration, getConstructType, getContainer, getDependencies, getEvaluationMethod, getHostLanguage, getImplementationMethod, getIntrinsicDependencies, getLineNumber, getLocationId, getObjectName, getPosture, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getStreamability, getSweep, getSystemId, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isIdentical, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterateEvents, makeStreamingAdjunct, markTailFunctionCalls, operandList, process, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, setPostureAndSweep, staticTypeCheck, suppressValidation, toStreamingPattern, typeErrorpublic static final int FILTERED
public static final OperandRole FILTER_PREDICATE
public FilterExpression(Expression base, Expression filter)
base - The base expression to be filtered.filter - An expression defining the filter predicatepublic String getExpressionName()
getExpressionName in class Expressionpublic ItemType getItemType()
getItemType in class Expressionpublic Expression getSelectExpression()
getSelectExpression in interface ContextSwitchingExpressionpublic boolean isFilterIsPositional()
FilterExpressionCompilerpublic Expression getActionExpression()
getActionExpression in interface ContextSwitchingExpressionpublic Expression getFilter()
public boolean isPositional(TypeHierarchy th)
th - the Type Hierarchy (for cached access to type information)public boolean isSimpleBooleanFilter()
This information is available only after typeCheck() has been called.
public boolean isIndependentFilter()
This information is available only after typeCheck() has been called.
public Expression simplify(ExpressionVisitor visitor) throws XPathException
simplify in class Expressionvisitor - the expression visitorXPathException - if any failure occurspublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
typeCheck in class ExpressioncontextInfo - return the expression after type-checking (potentially modified to add run-time
checks and/or conversions)visitor - an expression visitorXPathException - if an error is discovered during this phase
(typically a type error)public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
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.
optimize in class Expressionvisitor - 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 to
Type.ITEM_TYPEXPathException - if an error is discovered during this phase
(typically a type error)public IntegerValue[] getIntegerBounds()
getIntegerBounds in class Expressionpublic PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
addToPathMap in class ExpressionpathMap - the PathMap to which the expression should be addedpathMapNodeSet - the PathMapNodeSet to which the paths embodied in this expression should be addedpublic Expression promote(PromotionOffer offer, Expression parent) throws XPathException
promote in class Expressionoffer - details of the promotion that is possibleparent - the parent of this expression in the expression treeXPathException - if any error is detectedpublic Expression unordered(boolean retainAllNodes, boolean forStreaming) throws XPathException
unordered in class ExpressionretainAllNodes - set to true if the result must contain exactly the same nodes as the
original; set to false if the result can eliminate (or introduce) duplicates.forStreaming - set to true if optimizing for streamingXPathException - if the rewrite failspublic static boolean isPositionalFilter(Expression exp, TypeHierarchy th)
exp - the expression to be examinedth - the type hierarchy cachepublic Iterable<Operand> operands()
operands in class Expressionpublic boolean replaceOperand(Expression original, Expression replacement)
replaceOperand in class Expressionoriginal - the original subexpressionreplacement - the replacement subexpressionpublic int computeCardinality()
computeCardinality in class Expressionpublic int computeSpecialProperties()
computeSpecialProperties in class Expressionpublic boolean equals(Object other)
public int hashCode()
public Pattern toPattern(Configuration config, boolean is30) throws XPathException
toPattern in class Expressionconfig - the Saxon configurationis30 - true if this is XSLT 3.0XPathException - if conversion is not possiblepublic SequenceIterator iterate(XPathContext context) throws XPathException
iterate in class Expressioncontext - the dynamic context for the evaluationXPathException - if any dynamic error occurspublic int computeDependencies()
computeDependencies in class Expressionpublic Expression copy()
copy in class Expressionpublic ExpressionCompiler getExpressionCompiler()
getExpressionCompiler in class Expressionpublic FilterExpressionAdjunct getStreamingAdjunct()
getStreamingAdjunct in class Expressionpublic String toString()
toString in class Expressionpublic String toShortString()
ExpressiontoShortString in class Expressionpublic void explain(ExpressionPresenter out)
explain in class Expressionout - the ExpressionPresenter to be usedCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.