| java.lang.Object net.sf.saxon.pattern.Pattern
All known Subclasses: net.sf.saxon.pattern.NodeTestPattern, net.sf.saxon.pattern.UnionPattern, net.sf.saxon.pattern.IDPattern, net.sf.saxon.pattern.LocationPathPattern, net.sf.saxon.pattern.KeyPattern,
Pattern | abstract public class Pattern implements Serializable,Container(Code) | | A Pattern represents the result of parsing an XSLT pattern string.
Patterns are created by calling the static method Pattern.make(string).
The pattern is used to test a particular node by calling match().
|
analyze | public Pattern analyze(StaticContext env, ItemType contextItemType) throws XPathException(Code) | | Type-check the pattern.
Default implementation does nothing. This is only needed for patterns that contain
variable references or function calls.
the optimised Pattern |
getColumnNumber | public int getColumnNumber()(Code) | | Get the column number (always -1)
|
getDefaultPriority | public double getDefaultPriority()(Code) | | Determine the default priority to use if this pattern appears as a match pattern
for a template with no explicit priority attribute.
|
getDependencies | public int getDependencies()(Code) | | Get the dependencies of the pattern. The only possible dependency for a pattern is
on local variables. This is analyzed in those patterns where local variables may appear.
|
getFingerprint | public int getFingerprint()(Code) | | Determine the name fingerprint of nodes to which this pattern applies. Used for
optimisation.
A fingerprint that the nodes must match, or -1 if it can match multiple fingerprints |
getLineNumber | public int getLineNumber()(Code) | | Get the line number on which the pattern was defined
|
getLocationProvider | public LocationProvider getLocationProvider()(Code) | | Get the LocationProvider allowing location identifiers to be resolved.
|
getNodeKind | public int getNodeKind()(Code) | | Determine the types of nodes to which this pattern applies. Used for optimisation.
For patterns that match nodes of several types, return Type.NODE
the type of node matched by this pattern. e.g. Type.ELEMENT or Type.TEXT |
getNodeTest | abstract public NodeTest getNodeTest()(Code) | | Get a NodeTest that all the nodes matching this pattern must satisfy
|
getPublicId | public String getPublicId()(Code) | | Get the public ID (always null)
|
getSystemId | public String getSystemId()(Code) | | Get the system id of the entity in which the pattern occurred
|
internalMatches | protected boolean internalMatches(NodeInfo node, XPathContext context) throws XPathException(Code) | | Determine whether this Pattern matches the given Node. This is an internal interface used
for matching sub-patterns; it does not alter the value of current(). The default implementation
is identical to matches().
Parameters: node - The NodeInfo representing the Element or other node to be tested against the Pattern Parameters: context - The dynamic context. Only relevant if the patternuses variables, or contains calls on functions such as document() or key(). true if the node matches the Pattern, false otherwise |
iterateSubExpressions | public Iterator iterateSubExpressions()(Code) | | Iterate over the subexpressions within this pattern
|
make | public static Pattern make(String pattern, StaticContext env, Executable exec) throws XPathException(Code) | | Static method to make a Pattern by parsing a String.
Parameters: pattern - The pattern text as a String Parameters: env - An object defining the compile-time context for the expression The pattern object |
matches | abstract public boolean matches(NodeInfo node, XPathContext context) throws XPathException(Code) | | Determine whether this Pattern matches the given Node. This is the main external interface
for matching patterns: it sets current() to the node being tested
Parameters: node - The NodeInfo representing the Element or other node to be tested against the Pattern Parameters: context - The dynamic context. Only relevant if the patternuses variables, or contains calls on functions such as document() or key(). true if the node matches the Pattern, false otherwise |
promote | public void promote(PromotionOffer offer) throws XPathException(Code) | | Offer promotion for subexpressions within this pattern. The offer will be accepted if the subexpression
is not dependent on the factors (e.g. the context item) identified in the PromotionOffer.
By default the offer is not accepted - this is appropriate in the case of simple expressions
such as constant values and variable references where promotion would give no performance
advantage. This method is always called at compile time.
Unlike the corresponding method on
Expression , this method does not return anything:
it can make internal changes to the pattern, but cannot return a different pattern. Only certain
kinds of promotion are applicable within a pattern: specifically, promotions affecting local
variable references within the pattern.
Parameters: offer - details of the offer, for example the offer to moveexpressions that don't depend on the context to an outer level inthe containing expression throws: net.sf.saxon.trans.XPathException - if any error is detected |
setLineNumber | public void setLineNumber(int lineNumber)(Code) | | Set the line number where the pattern occurred
|
setOriginalText | public void setOriginalText(String text)(Code) | | Set the original text of the pattern for use in diagnostics
|
setSystemId | public void setSystemId(String systemId)(Code) | | Set the system ID where the pattern occurred
|
simplify | public Pattern simplify(StaticContext env) throws XPathException(Code) | | Simplify the pattern by applying any context-independent optimisations.
Default implementation does nothing.
the optimised Pattern |
toString | public String toString()(Code) | | Get the original pattern text
|
|
|