Package net.sf.saxon.expr
Class SingletonIntersectExpression
java.lang.Object
net.sf.saxon.expr.Expression
net.sf.saxon.expr.BinaryExpression
net.sf.saxon.expr.VennExpression
net.sf.saxon.expr.SingletonIntersectExpression
- All Implemented Interfaces:
ExportAgent,Locatable,IdentityComparable,Traceable
This expression is equivalent to (A intersect B) in the case where A has cardinality
zero-or-one. This is handled as a special case because the standard sort-merge algorithm
involves an unnecessary sort on B.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classElaborator for a Venn expression: that isA union B,A intersect B, orA except BNested classes/interfaces inherited from class net.sf.saxon.expr.VennExpression
VennExpression.VennElaborator -
Field Summary
Fields inherited from class net.sf.saxon.expr.BinaryExpression
operatorFields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD -
Constructor Summary
ConstructorsConstructorDescriptionSingletonIntersectExpression(Expression p1, int op, Expression p2) Special case of an intersect expression where the first argument is a singleton -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsNode(SequenceIterator iter, NodeInfo m) Ask whether the sequence supplied in the first argument contains the node supplied in the secondcopy(RebindingMap rebindings) Copy an expression.protected StringDisplay the operator used by this binary expressionbooleanGet the effective boolean value.Make an elaborator for this expressionGet a name identifying the kind of expression, in terms meaningful to a user.Iterate over the value of the expression.optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) Perform optimisation of an expression and its subexpressions.simplify()Simplify the expressionprotected Stringtag()Get the element name used to identify this expression in exported expression formatMethods inherited from class net.sf.saxon.expr.VennExpression
computeCardinality, computeHashCode, computeSpecialProperties, equals, gatherComponents, getImplementationMethod, getItemType, getOperandRole, getStaticUType, getStreamerName, toPattern, typeCheck, unorderedMethods inherited from class net.sf.saxon.expr.BinaryExpression
explainExtraAttributes, export, getLhs, getLhsExpression, getOperator, getRhs, getRhsExpression, isAssociative, isCommutative, isInverse, operands, setFlattened, setLhsExpression, setRhsExpression, toShortString, toStringMethods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dispatchTailCall, dynamicError, evaluateAsString, evaluateItem, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, typeCheckChildren, typeError, verifyParentPointers, withLocationMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
Constructor Details
-
SingletonIntersectExpression
Special case of an intersect expression where the first argument is a singleton- Parameters:
p1- the first argument, always a singletonop- the operator, always Token.INTERSECTp2- the second argument
-
-
Method Details
-
simplify
Simplify the expression- Overrides:
simplifyin classVennExpression- Returns:
- the simplified expression (or the original if unchanged, or if modified in-situ)
- Throws:
XPathException- if an error is discovered during expression rewriting
-
optimize
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException 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.
- Overrides:
optimizein classVennExpression- Parameters:
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 toType.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)
-
copy
Copy an expression. This makes a deep copy.- Overrides:
copyin classVennExpression- Parameters:
rebindings- variables that need to be re-bound- Returns:
- the copy of the original expression
-
iterate
Iterate over the value of the expression. The result will always be sorted in document order, with duplicates eliminated- Overrides:
iteratein classVennExpression- Parameters:
c- The context for evaluation- Returns:
- a SequenceIterator representing the union of the two operands
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-
effectiveBooleanValue
Get the effective boolean value. In the case of a union expression, this is reduced to an OR expression, for efficiency- Overrides:
effectiveBooleanValuein classVennExpression- Parameters:
c- The context in which the expression is to be evaluated- Returns:
- the effective boolean value
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-
containsNode
Ask whether the sequence supplied in the first argument contains the node supplied in the second- Parameters:
iter- an iterator over nodes. The iterator will be closed if the node is found.m- the node to be tested- Returns:
- true if (and only if) the sequence contains the node
- Throws:
XPathException- if evaluating the iterator fails
-
getExpressionName
Description copied from class:VennExpressionGet a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionNamein classVennExpression- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.
-
displayOperator
Display the operator used by this binary expression- Overrides:
displayOperatorin classBinaryExpression- Returns:
- String representation of the operator (for diagnostic display only)
-
tag
Get the element name used to identify this expression in exported expression format- Overrides:
tagin classVennExpression- Returns:
- the element name used to identify this expression
-
getElaborator
Make an elaborator for this expression- Overrides:
getElaboratorin classVennExpression- Returns:
- a suitable elaborator
-