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 |
computeHashCode()
get HashCode for comparing two expressions
|
int |
computeSpecialProperties()
Get the static properties of this expression (other than its type).
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
boolean |
equals(java.lang.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.
|
java.lang.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
|
UType |
getStaticUType(UType contextItemType)
Get the static type of the expression as a UType, following precisely the type
inference rules defined in the XSLT 3.0 specification.
|
java.lang.String |
getStreamerName()
Get the (partial) name of a class that supports streaming of this kind of expression
|
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.
|
void |
setBase(Expression base) |
void |
setFilter(Expression filter) |
void |
setFlags(java.lang.String flags) |
Expression |
simplify()
Simplify an expression
|
Pattern |
toPattern(Configuration config,
boolean is30)
Convert this expression to an equivalent XSLT pattern
|
java.lang.String |
toShortString()
Produce a short string identifying the expression for use in error messages
|
java.lang.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, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getDependencies, getEvaluationMethod, getExtraProperty, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, hasCompatibleStaticContext, hashCode, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isInstruction, isLiftable, isMultiThreaded, isSameExpression, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, typeCheckChildren, typeError, verifyParentPointers, verifyParentPointers
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 java.lang.String getExpressionName()
getExpressionName
in class Expression
public ItemType getItemType()
getItemType
in class Expression
public UType getStaticUType(UType contextItemType)
getStaticUType
in class Expression
contextItemType
- 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 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(java.lang.Object other)
equals
in class BinaryExpression
other
- the expression to be compared with this onepublic int computeHashCode()
computeHashCode
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(RebindingMap rebindings)
copy
in class Expression
rebindings
- a mutable list of (old binding, new binding) pairs
that is used to update the bindings held in any
local variable references that are copied.public java.lang.String getStreamerName()
getStreamerName
in class Expression
public java.lang.String toString()
toString
in class BinaryExpression
public java.lang.String toShortString()
Expression
toShortString
in class BinaryExpression
public void export(ExpressionPresenter out) throws XPathException
export
in interface ExportAgent
export
in class BinaryExpression
out
- the ExpressionPresenter to be usedXPathException
- if the export fails, for example if an expression is found that won't work
in the target environment.public void setFlags(java.lang.String flags)
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.