public abstract class AbstractPatternWorker extends java.lang.Object implements PatternWorker
The most important usage note is that it is not possible for sub-classes
to pass the libraries array of Object instances
(the list of exported libraries to register) in the constructor of a
super class. For this reason, a separate setLibraries
method has been provided which must be called in the sub-class'
constructor, after the super constructor has been
invoked.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object |
library
Library object (exports functions/variables to rulesets) to register
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPatternWorker()
Default constructor, which can only be called by a sub-class.
|
| Modifier and Type | Method and Description |
|---|---|
protected Aast |
getCopy()
Get the current copy AST.
|
java.lang.Object |
getLibrary()
Get the user function/property library exposed by this pattern worker.
|
protected AstSymbolResolver |
getResolver()
Get the
AstSymbolResolver for the current context. |
protected Aast |
getSource()
Get the current source AST.
|
boolean |
isConditionalRuleSets()
Check if conditional rule-sets is activated.
|
boolean |
isFlagActivated(java.lang.String flag)
If conditional rule-set is enabled, check if the given flag is activated.
|
boolean |
isRuntimeQueryMode()
Check if the current mode is for runtime-conversion of query/tables.
|
void |
registerTree(Aast ast)
Register the given tree with the AST resolver.
|
java.lang.Object |
resolveConstant(java.lang.String constant)
This method is called each time the pattern engine needs to resolve
a string constant into a numeric, boolean, or string literal value.
|
protected void |
setLibrary(java.lang.Object library)
Sets the library that must be registered.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfinish, initialize, leaveAst, visitAstprivate java.lang.Object library
protected AbstractPatternWorker()
public boolean isRuntimeQueryMode()
public boolean isFlagActivated(java.lang.String flag)
flag - The flag to check.PatternEngine.isFlagActivated(String)public boolean isConditionalRuleSets()
PatternEngine.isConditionalRuleSets()public void registerTree(Aast ast)
ast - Tree to register.public java.lang.Object getLibrary()
getLibrary in interface PatternWorkernull if the pattern
worker implementation does not need to register a library.PatternWorker.getLibrary()public java.lang.Object resolveConstant(java.lang.String constant)
It must return an object of the following type (or null):
resolveConstant in interface PatternWorkerconstant - A string representing a constant to be resolved.null.protected void setLibrary(java.lang.Object library)
library - Instance of exported libraries to be registered with the
resolver. Must not be null.java.lang.IllegalArgumentException - if library is null.protected Aast getSource()
protected Aast getCopy()
protected AstSymbolResolver getResolver()
AstSymbolResolver for the current context.AstSymbolResolver.getResolver()