public abstract class Pattern extends Object implements Serializable, Container
Constructor and Description |
---|
Pattern() |
Modifier and Type | Method and Description |
---|---|
Pattern |
analyze(StaticContext env,
ItemType contextItemType)
Type-check the pattern.
|
int |
getColumnNumber()
Get the column number (always -1)
|
double |
getDefaultPriority()
Determine the default priority to use if this pattern appears as a match pattern
for a template with no explicit priority attribute.
|
int |
getDependencies()
Get the dependencies of the pattern.
|
Executable |
getExecutable()
Get the Executable (representing a complete stylesheet or query) of which this Container forms part
|
int |
getFingerprint()
Determine the name fingerprint of nodes to which this pattern applies.
|
int |
getHostLanguage()
Get the host language (XSLT, XQuery, XPath) used to implement the code in this container
|
int |
getLineNumber()
Get the line number on which the pattern was defined
|
LocationProvider |
getLocationProvider()
Get the LocationProvider allowing location identifiers to be resolved.
|
int |
getNodeKind()
Determine the types of nodes to which this pattern applies.
|
abstract NodeTest |
getNodeTest()
Get a NodeTest that all the nodes matching this pattern must satisfy
|
String |
getPublicId()
Get the public ID (always null)
|
String |
getSystemId()
Get the system id of the entity in which the pattern occurred
|
protected boolean |
internalMatches(NodeInfo node,
XPathContext context)
Determine whether this Pattern matches the given Node.
|
Iterator |
iterateSubExpressions()
Iterate over the subexpressions within this pattern
|
static Pattern |
make(String pattern,
StaticContext env,
Executable exec)
Static method to make a Pattern by parsing a String.
|
abstract boolean |
matches(NodeInfo node,
XPathContext context)
Determine whether this Pattern matches the given Node.
|
void |
promote(PromotionOffer offer)
Offer promotion for subexpressions within this pattern.
|
void |
setExecutable(Executable executable) |
void |
setLineNumber(int lineNumber)
Set the line number where the pattern occurred
|
void |
setOriginalText(String text)
Set the original text of the pattern for use in diagnostics
|
void |
setSystemId(String systemId)
Set the system ID where the pattern occurred
|
Pattern |
simplify(StaticContext env)
Simplify the pattern by applying any context-independent optimisations.
|
String |
toString()
Get the original pattern text
|
public static Pattern make(String pattern, StaticContext env, Executable exec) throws XPathException
pattern
- The pattern text as a Stringenv
- An object defining the compile-time context for the expressionXPathException
public Executable getExecutable()
Container
getExecutable
in interface Container
public void setExecutable(Executable executable)
public LocationProvider getLocationProvider()
getLocationProvider
in interface Container
public void setOriginalText(String text)
public Pattern simplify(StaticContext env) throws XPathException
XPathException
public Pattern analyze(StaticContext env, ItemType contextItemType) throws XPathException
XPathException
public int getDependencies()
public Iterator iterateSubExpressions()
public void promote(PromotionOffer offer) throws XPathException
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.
offer
- details of the offer, for example the offer to move
expressions that don't depend on the context to an outer level in
the containing expressionXPathException
- if any error is detectedpublic void setSystemId(String systemId)
public void setLineNumber(int lineNumber)
public abstract boolean matches(NodeInfo node, XPathContext context) throws XPathException
node
- The NodeInfo representing the Element or other node to be tested against the Patterncontext
- The dynamic context. Only relevant if the pattern
uses variables, or contains calls on functions such as document() or key().XPathException
protected boolean internalMatches(NodeInfo node, XPathContext context) throws XPathException
node
- The NodeInfo representing the Element or other node to be tested against the Patterncontext
- The dynamic context. Only relevant if the pattern
uses variables, or contains calls on functions such as document() or key().XPathException
public int getNodeKind()
public int getFingerprint()
public abstract NodeTest getNodeTest()
public double getDefaultPriority()
public String getSystemId()
getSystemId
in interface SourceLocator
public int getLineNumber()
getLineNumber
in interface SourceLocator
public int getColumnNumber()
getColumnNumber
in interface SourceLocator
public String getPublicId()
getPublicId
in interface SourceLocator
public int getHostLanguage()
getHostLanguage
in interface Container
Configuration.XSLT
or Configuration.XQUERY