Package net.sf.saxon.pattern
Class IntersectPattern
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.PseudoExpression
-
- net.sf.saxon.pattern.Pattern
-
- net.sf.saxon.pattern.VennPattern
-
- net.sf.saxon.pattern.IntersectPattern
-
- All Implemented Interfaces:
ExportAgent
,Locatable
,IdentityComparable
,Traceable
public class IntersectPattern extends VennPattern
A pattern formed as the difference of two other patterns
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.pattern.VennPattern
p1, p2
-
Fields 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
Constructors Constructor Description IntersectPattern(Pattern p1, Pattern p2)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
computeHashCode()
Hashcode supporting equals()Pattern
convertToTypedPattern(java.lang.String val)
Convert the pattern to a typed pattern, in which an element name is treated as schema-element(N)Pattern
copy(RebindingMap rebindings)
Copy a pattern.boolean
equals(java.lang.Object other)
Determine whether this pattern is the same as another patterndouble
getDefaultPriority()
The default priority of an "intersect" pattern is the priority of the LH operandItemType
getItemType()
Get an ItemType that all the items matching this pattern must satisfyprotected java.lang.String
getOperatorName()
Get the relevant operator: "union", "intersect", or "except"UType
getUType()
Get a UType indicating which kinds of items this Pattern can match.boolean
matches(Item item, XPathContext context)
Determine if the supplied node matches the patternboolean
matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context)
Determine whether this pattern matches a given Node within the subtree rooted at a given anchor node.-
Methods inherited from class net.sf.saxon.pattern.VennPattern
allocateSlots, bindCurrent, export, gatherComponentPatterns, getDependencies, getLHS, getRHS, isMotionless, matchesCurrentGroup, operands, reconstruct, simplify, typeCheck
-
Methods inherited from class net.sf.saxon.pattern.Pattern
effectiveBooleanValue, getFingerprint, getHostLanguage, getOriginalText, handleDynamicError, isLiftable, isRecoverable, make, optimize, patternContainsVariable, replaceCurrent, selectNodes, setOriginalText, setPriority, setRecoverable, toPattern, toShortString, toString
-
Methods inherited from class net.sf.saxon.expr.PseudoExpression
computeCardinality, evaluateAsString, evaluateItem, getImplementationMethod, iterate, process
-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeSpecialProperties, computeStaticProperties, dynamicError, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getEvaluationMethod, getExpressionName, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, typeCheckChildren, typeError, unordered, verifyParentPointers
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
-
-
-
Method Detail
-
getItemType
public ItemType getItemType()
Get an ItemType that all the items matching this pattern must satisfy- Specified by:
getItemType
in classPattern
- Returns:
- an ItemType, as specific as possible, which all the matching items satisfy
-
getUType
public UType getUType()
Get a UType indicating which kinds of items this Pattern can match.
-
getDefaultPriority
public double getDefaultPriority()
The default priority of an "intersect" pattern is the priority of the LH operand- Overrides:
getDefaultPriority
in classPattern
- Returns:
- the priority of the LH operand
-
matches
public boolean matches(Item item, XPathContext context) throws XPathException
Determine if the supplied node matches the pattern- Specified by:
matches
in classPattern
- Parameters:
item
- the node to be comparedcontext
- The dynamic context.- Returns:
- true if the node matches either of the operand patterns
- Throws:
XPathException
- if an error occurs while matching the pattern (the caller will usually treat this the same as a false result)
-
matchesBeneathAnchor
public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException
Determine whether this pattern matches a given Node within the subtree rooted at a given anchor node. This method is used when the pattern is used for streaming.- Overrides:
matchesBeneathAnchor
in classPattern
- Parameters:
node
- The NodeInfo representing the Element or other node to be tested against the Patternanchor
- The anchor node, which must match any AnchorPattern subpatterncontext
- The dynamic context. Only relevant if the pattern uses variables, or contains calls on functions such as document() or key().- Returns:
- true if the node matches the Pattern, false otherwise
- Throws:
XPathException
- if an error occurs while matching the pattern (the caller will usually treat this the same as a false result)
-
convertToTypedPattern
public Pattern convertToTypedPattern(java.lang.String val) throws XPathException
Convert the pattern to a typed pattern, in which an element name is treated as schema-element(N)- Overrides:
convertToTypedPattern
in classPattern
- Parameters:
val
- either "strict" or "lax" depending on the value of xsl:mode/@typed- Returns:
- either the original pattern unchanged, or a new pattern as the result of the conversion
- Throws:
XPathException
- if the pattern cannot be converted
-
equals
public boolean equals(java.lang.Object other)
Determine whether this pattern is the same as another pattern- Overrides:
equals
in classVennPattern
- Parameters:
other
- the other object- Returns:
- true if the other operand is an expression and if it can be determined that the two expressions are equivalent, in the sense that they will always return the same result.
-
computeHashCode
protected int computeHashCode()
Hashcode supporting equals()- Overrides:
computeHashCode
in classVennPattern
- Returns:
- a computed hash code
-
getOperatorName
protected java.lang.String getOperatorName()
Get the relevant operator: "union", "intersect", or "except"- Specified by:
getOperatorName
in classVennPattern
- Returns:
- the operator, as a string
-
copy
public Pattern copy(RebindingMap rebindings)
Copy a pattern. This makes a deep copy.
-
-