Package net.sf.saxon.pattern
Class UnionPattern
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.UnionPattern
- All Implemented Interfaces:
ExportAgent
,Locatable
,IdentityComparable
,Traceable
A pattern formed as the union (or) 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected int
Hashcode supporting equals()Convert the pattern to a typed pattern, in which an element name is treated as schema-element(N)copy
(RebindingMap rebindings) Copy a pattern.boolean
Determine whether this pattern is the same as another patternGet an ItemType that all the items matching this pattern must satisfyprotected String
Get the relevant operator: "union", "intersect", or "except"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, getDefaultPriority, getElaborator, getFingerprint, getHostLanguage, getOriginalText, handleDynamicError, isLiftable, isRecoverable, make, matchesItem, 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, dispatchTailCall, dynamicError, explain, getCardinality, getConfiguration, getCost, getEvaluationMethod, getExpressionName, getExtraProperty, getIntegerBounds, 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, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, typeCheckChildren, typeError, unordered, verifyParentPointers, withLocation
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
-
Constructor Details
-
UnionPattern
Constructor- Parameters:
p1
- the left-hand operandp2
- the right-hand operand
-
-
Method Details
-
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
Get a UType indicating which kinds of items this Pattern can match. -
matches
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
-
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
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
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
Get the relevant operator: "union", "intersect", or "except"- Specified by:
getOperatorName
in classVennPattern
- Returns:
- the operator, as a string
-
copy
Copy a pattern. This makes a deep copy.
-