|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xalan.xsltc.compiler.SyntaxTreeNode org.apache.xalan.xsltc.compiler.Expression org.apache.xalan.xsltc.compiler.Predicate
final class Predicate
Field Summary | |
---|---|
private boolean |
_canOptimize
This flag indicates if optimizations are turned on. |
private java.lang.String |
_className
Name of the inner class. |
private java.util.ArrayList |
_closureVars
List of variables in closure. |
private Expression |
_exp
The predicate's expression. |
private boolean |
_nthDescendant
Flag indicatig if the nth position descendant is on. |
private boolean |
_nthPositionFilter
Flag indicatig if the nth position optimization is on. |
private Closure |
_parentClosure
Reference to parent closure. |
(package private) int |
_ptype
Cached node type of the expression that owns this predicate. |
private Step |
_step
Cached value of method getCompareValue() . |
private Expression |
_value
Cached value of method getCompareValue() . |
Fields inherited from class org.apache.xalan.xsltc.compiler.Expression |
---|
_falseList, _trueList, _type |
Fields inherited from class org.apache.xalan.xsltc.compiler.SyntaxTreeNode |
---|
_attributes, _parent, _qname, Dummy, IndentIncrement, UNKNOWN_STYLESHEET_NODE_ID |
Constructor Summary | |
---|---|
Predicate(Expression exp)
Initializes a predicate. |
Method Summary | |
---|---|
void |
addVariable(VariableRefBase variableRef)
Add new variable to the closure. |
private void |
compileFilter(ClassGenerator classGen,
MethodGenerator methodGen)
Create a new "Filter" class implementing CurrentNodeListFilter . |
void |
dontOptimize()
Turns off all optimizations for this predicate. |
Expression |
getCompareValue()
Returns the value in an expression of the form 'step = value'. |
Expression |
getExpr()
|
java.lang.String |
getInnerClassName()
Returns the name of the auxiliary class or null if this predicate is compiled inside the Translet. |
Closure |
getParentClosure()
Returns a reference to its parent closure or null if outermost. |
int |
getPosType()
Returns the node type of the expression owning this predicate. |
Step |
getStep()
Returns the step in an expression of the form 'step = value'. |
boolean |
hasLastCall()
Returns true if the expression in this predicate contains a call to last(). |
boolean |
hasPositionCall()
Returns true if the expression in this predicate contains a call to position(). |
boolean |
inInnerClass()
Returns true if this closure is compiled in an inner class (i.e. |
boolean |
isBooleanTest()
Returns true if the predicate is a test for the existance of an element or attribute. |
boolean |
isNodeValueTest()
Method to see if we can optimise the predicate by using a specialised iterator for expressions like '/foo/bar[@attr = $var]', which are very common in many stylesheets |
boolean |
isNthDescendant()
Returns a boolean value indicating if the nth descendant optimization is on. |
boolean |
isNthPositionFilter()
Returns a boolean value indicating if the nth position optimization is on. |
boolean |
parentIsPattern()
|
void |
setParser(Parser parser)
Set the parser for this expression. |
java.lang.String |
toString()
|
void |
translate(ClassGenerator classGen,
MethodGenerator methodGen)
Translate a predicate expression. |
void |
translateFilter(ClassGenerator classGen,
MethodGenerator methodGen)
Translate a predicate expression. |
Type |
typeCheck(SymbolTable stable)
Type check a predicate expression. |
Methods inherited from class org.apache.xalan.xsltc.compiler.Expression |
---|
backPatchFalseList, backPatchTrueList, compile, desynthesize, evaluateAtCompileTime, getFalseList, getTrueList, getType, lookupPrimop, startIterator, synthesize, translateDesynthesized |
Methods inherited from class org.apache.xalan.xsltc.compiler.SyntaxTreeNode |
---|
addAttribute, addElement, addPrefixMapping, compileResultTree, contextDependent, dependentContents, display, displayContents, elementAt, elementCount, elements, getAttribute, getAttribute, getAttributes, getContents, getImportPrecedence, getLineNumber, getNodeIDForStylesheetNSLookup, getParent, getParser, getPrefixMapping, getQName, getStylesheet, getSymbolTable, getTemplate, getXSLTC, hasAttribute, hasContents, indent, isDummy, lastChild, lookupNamespace, lookupPrefix, parseChildren, parseContents, removeElement, reportError, reportWarning, setAttributes, setFirstElement, setLineNumber, setParent, setPrefixMapping, setQName, setQName, translateContents, typeCheckContents, updateScope |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Expression _exp
private boolean _canOptimize
dontOptimize()
can be called to turn
optimizations off.
private boolean _nthPositionFilter
typeCheck()
.
private boolean _nthDescendant
typeCheck()
.
int _ptype
private java.lang.String _className
private java.util.ArrayList _closureVars
private Closure _parentClosure
private Expression _value
getCompareValue()
.
private Step _step
getCompareValue()
.
Constructor Detail |
---|
public Predicate(Expression exp)
Method Detail |
---|
public void setParser(Parser parser)
setParser
in class SyntaxTreeNode
parser
- The XSLT parser.public boolean isNthPositionFilter()
public boolean isNthDescendant()
public void dontOptimize()
public boolean hasPositionCall()
hasPositionCall
in class Expression
public boolean hasLastCall()
hasLastCall
in class Expression
public boolean inInnerClass()
inInnerClass
in interface Closure
public Closure getParentClosure()
getParentClosure
in interface Closure
public java.lang.String getInnerClassName()
getInnerClassName
in interface Closure
public void addVariable(VariableRefBase variableRef)
addVariable
in interface Closure
public int getPosType()
_ptype
.
public boolean parentIsPattern()
public Expression getExpr()
public java.lang.String toString()
toString
in class Expression
public Type typeCheck(SymbolTable stable) throws TypeCheckError
dontOptimize()
. If so, the second time it should honor
the new value of _canOptimize
.
typeCheck
in class Expression
stable
- The compiler/parser's symbol table
TypeCheckError
private void compileFilter(ClassGenerator classGen, MethodGenerator methodGen)
CurrentNodeListFilter
. Allocate registers for local
variables and local parameters passed in the closure to test().
Notice that local variables need to be "unboxed".
public boolean isBooleanTest()
public boolean isNodeValueTest()
public Step getStep()
public Expression getCompareValue()
public void translateFilter(ClassGenerator classGen, MethodGenerator methodGen)
public void translate(ClassGenerator classGen, MethodGenerator methodGen)
Step
for further details.
translate
in class Expression
classGen
- BCEL Java class generatormethodGen
- BCEL Java method generator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |