| Modifier and Type | Field and Description |
|---|---|
| private boolean | _canOptimize
This flag indicates if optimizations are turned on. |
| private String | _className
Name of the inner class. |
| private List | _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. |
| pack-priv int | _ptype
Cached node type of the expression that owns this predicate. |
| private Step | _step
Cached value of method |
| private Expression | _value
Cached value of method |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addVariable(VariableRefBase variableRef)
Implements com. Add new variable to the closure. |
| private void | compileFilter(ClassGenerator classGen, MethodGenerator methodGen)
Create a new "Filter" class implementing
|
| public void | |
| public Expression | |
| public Expression | |
| public String | getInnerClassName()
Implements com. Returns the name of the auxiliary class or null if this predicate is compiled inside the Translet. |
| public Closure | getParentClosure()
Implements com. Returns a reference to its parent closure or null if outermost. |
| public int | |
| public Step | |
| public boolean | hasLastCall()
Overrides com. Returns true if the expression in this predicate contains a call to last(). |
| public boolean | hasPositionCall()
Overrides com. Returns true if the expression in this predicate contains a call to position(). |
| public boolean | inInnerClass()
Implements com. Returns true if this closure is compiled in an inner class (i.e. if this is a real closure). |
| public boolean | isBooleanTest()
Returns true if the predicate is a test for the existance of an element or attribute. |
| public 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 |
| public boolean | |
| public boolean | |
| public boolean | |
| public void | setParser(Parser parser)
Overrides com. Set the parser for this expression. |
| public String | toString()
Implements abstract com. Returns a string representation of the object. |
| public void | translate(ClassGenerator classGen, MethodGenerator methodGen)
Overrides com. Translate a predicate expression. |
| public void | translateFilter(ClassGenerator classGen, MethodGenerator methodGen)
Translate a predicate expression. |
| public Type | typeCheck(SymbolTable stable)
Overrides com. Type check a predicate expression. |
| _canOptimize | back to summary |
|---|---|
| private boolean _canOptimize This flag indicates if optimizations are turned on. The
method | |
| _className | back to summary |
|---|---|
| private String _className Name of the inner class. | |
| _closureVars | back to summary |
|---|---|
| private List<VariableRefBase> _closureVars List of variables in closure. | |
| _exp | back to summary |
|---|---|
| private Expression _exp The predicate's expression. | |
| _nthDescendant | back to summary |
|---|---|
| private boolean _nthDescendant Flag indicatig if the nth position descendant is on. It
is set in | |
| _nthPositionFilter | back to summary |
|---|---|
| private boolean _nthPositionFilter Flag indicatig if the nth position optimization is on. It
is set in | |
| _parentClosure | back to summary |
|---|---|
| private Closure _parentClosure Reference to parent closure. | |
| _ptype | back to summary |
|---|---|
| pack-priv int _ptype Cached node type of the expression that owns this predicate. | |
| _step | back to summary |
|---|---|
| private Step _step Cached value of method | |
| _value | back to summary |
|---|---|
| private Expression _value Cached value of method | |
| Predicate | back to summary |
|---|---|
| public Predicate(Expression exp) Initializes a predicate. | |
| addVariable | back to summary |
|---|---|
| public void addVariable(VariableRefBase variableRef) Implements com. Add new variable to the closure. | |
| compileFilter | back to summary |
|---|---|
| private void compileFilter(ClassGenerator classGen, MethodGenerator methodGen) Create a new "Filter" class implementing
| |
| dontOptimize | back to summary |
|---|---|
| public void dontOptimize() Turns off all optimizations for this predicate. | |
| getCompareValue | back to summary |
|---|---|
| public Expression getCompareValue() Returns the value in an expression of the form 'step = value'. A value may be either a literal string or a variable whose type is string. Optimization if off if null is returned. | |
| getExpr | back to summary |
|---|---|
| public Expression getExpr() | |
| getInnerClassName | back to summary |
|---|---|
| public String getInnerClassName() Implements com. Returns the name of the auxiliary class or null if this predicate is compiled inside the Translet. | |
| getParentClosure | back to summary |
|---|---|
| public Closure getParentClosure() Implements com. Returns a reference to its parent closure or null if outermost. | |
| getPosType | back to summary |
|---|---|
| public int getPosType() Returns the node type of the expression owning this predicate. The
return value is cached in | |
| getStep | back to summary |
|---|---|
| public Step getStep() Returns the step in an expression of the form 'step = value'. Null is returned if the expression is not of the right form. Optimization if off if null is returned. | |
| hasLastCall | back to summary |
|---|---|
| public boolean hasLastCall() Overrides com. Returns true if the expression in this predicate contains a call to last(). | |
| hasPositionCall | back to summary |
|---|---|
| public boolean hasPositionCall() Overrides com. Returns true if the expression in this predicate contains a call to position(). | |
| inInnerClass | back to summary |
|---|---|
| public boolean inInnerClass() Implements com. Returns true if this closure is compiled in an inner class (i.e. if this is a real closure). | |
| isBooleanTest | back to summary |
|---|---|
| public boolean isBooleanTest() Returns true if the predicate is a test for the existance of an element or attribute. All we have to do is to get the first node from the step, check if it is there, and then return true/false. | |
| isNodeValueTest | back to summary |
|---|---|
| public 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 | |
| isNthDescendant | back to summary |
|---|---|
| public boolean isNthDescendant() Returns a boolean value indicating if the nth descendant optimization is on. Must be call after type checking! | |
| isNthPositionFilter | back to summary |
|---|---|
| public boolean isNthPositionFilter() Returns a boolean value indicating if the nth position optimization is on. Must be call after type checking! | |
| parentIsPattern | back to summary |
|---|---|
| public boolean parentIsPattern() | |
| setParser | back to summary |
|---|---|
| public void setParser(Parser parser) Overrides com. Set the parser for this expression. | |
| toString | back to summary |
|---|---|
| public String toString() Implements abstract com. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| translate | back to summary |
|---|---|
| public void translate(ClassGenerator classGen, MethodGenerator methodGen) Overrides com. Translate a predicate expression. If non of the optimizations apply
then this translation pushes two references on the stack: a reference
to a newly created filter object and a reference to the predicate's
closure. See class | |
| translateFilter | back to summary |
|---|---|
| public void translateFilter(ClassGenerator classGen, MethodGenerator methodGen) Translate a predicate expression. This translation pushes two references on the stack: a reference to a newly created filter object and a reference to the predicate's closure. | |
| typeCheck | back to summary |
|---|---|
| public Type typeCheck(SymbolTable stable) throws TypeCheckError Overrides com. Type check a predicate expression. If the type of the expression is
number convert it to boolean by adding a comparison with position().
Note that if the expression is a parameter, we cannot distinguish
at compile time if its type is number or not. Hence, expressions of
reference type are always converted to booleans.
This method may be called twice, before and after calling
| |