public final class FilterExpression extends BinaryExpression implements ContextSwitchingExpression
Modifier and Type | Field and Description |
---|---|
static OperandRole |
FILTER_PREDICATE |
static int |
FILTERED |
operator
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, 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 |
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 |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
Expression |
getActionExpression()
Get the subexpression that is evaluated in the new context
|
Expression |
getBase() |
int |
getCost()
Return the estimated cost of evaluating an expression.
|
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
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
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
|
protected OperandRole |
getOperandRole(int arg)
Get the operand role
|
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
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.
|
Expression |
promote(PromotionOffer offer)
Promote this expression if possible
|
void |
setBase(Expression base) |
void |
setFilter(Expression filter) |
void |
setFlags(String flags) |
Expression |
simplify()
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.
|
displayOperator, explainExtraAttributes, getLhs, getLhsExpression, getOperator, getRhs, getRhsExpression, isAssociative, isCommutative, isInverse, operands, setFlattened, setLhsExpression, setRhsExpression, tag
adoptChildExpression, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, clearStreamabilityData, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getDependencies, getEvaluationMethod, getHostLanguage, getIntrinsicDependencies, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getPosture, getPostureAndSweepIfKnown, getProperties, getProperty, getRetainedStaticContext, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStreamability, getSweep, getSystemId, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterateEvents, makeStreamingAdjunct, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, optimizeForType, process, promoteChildren, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setFiltered, setLocation, setParentExpression, setPostureAndSweep, setRetainedStaticContext, setRetainedStaticContextLocally, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, toStreamingPattern, typeCheckChildren, typeError
public 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 predicateprotected OperandRole getOperandRole(int arg)
BinaryExpression
getOperandRole
in class BinaryExpression
arg
- which argument: 0 for the lhs, 1 for the rhspublic Expression getBase()
public void setBase(Expression base)
public Expression getFilter()
public void setFilter(Expression filter)
public String getExpressionName()
getExpressionName
in class Expression
public ItemType getItemType()
getItemType
in class Expression
public Expression getSelectExpression()
getSelectExpression
in interface ContextSwitchingExpression
public boolean isFilterIsPositional()
FilterExpressionCompiler
public Expression getActionExpression()
getActionExpression
in interface ContextSwitchingExpression
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() throws XPathException
simplify
in class Expression
XPathException
- if any failure occurspublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
typeCheck
in class BinaryExpression
contextInfo
- 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 BinaryExpression
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 to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public int getCost()
getCost
in class Expression
public int getImplementationMethod()
getImplementationMethod
in class BinaryExpression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public IntegerValue[] getIntegerBounds()
getIntegerBounds
in class Expression
public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
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 addedpublic Expression promote(PromotionOffer offer) throws XPathException
promote
in class Expression
offer
- details of the promotion that is possibleXPathException
- if any error is detectedpublic Expression unordered(boolean retainAllNodes, boolean forStreaming) throws XPathException
unordered
in class Expression
retainAllNodes
- 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 int computeCardinality()
computeCardinality
in class BinaryExpression
public int computeSpecialProperties()
computeSpecialProperties
in class BinaryExpression
public boolean equals(Object other)
equals
in class BinaryExpression
other
- the expression to be compared with this onepublic int hashCode()
hashCode
in class BinaryExpression
public Pattern toPattern(Configuration config, boolean is30) throws XPathException
toPattern
in class Expression
config
- the Saxon configurationis30
- true if this is XSLT 3.0XPathException
- if conversion is not possiblepublic SequenceIterator iterate(XPathContext context) throws XPathException
iterate
in class Expression
context
- the dynamic context for the evaluationXPathException
- if any dynamic error occurspublic Expression copy()
copy
in class Expression
public ExpressionCompiler getExpressionCompiler()
getExpressionCompiler
in class Expression
public FilterExpressionAdjunct getStreamingAdjunct()
getStreamingAdjunct
in class Expression
public String toString()
toString
in class BinaryExpression
public String toShortString()
Expression
toShortString
in class BinaryExpression
public void export(ExpressionPresenter out)
export
in class BinaryExpression
out
- the ExpressionPresenter to be usedpublic void setFlags(String flags)
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.