|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectantlr.TreeParser
org.apache.jdo.impl.jdoql.jdoqlc.Optimizer
This class defines the optimizer pass of the JDOQL compiler. It takes the typed AST as produced by the smenatic analysis and converts it into a simpler but equivalent typed AST.
Field Summary | |
static java.lang.String[] |
_tokenNames
|
protected ErrorMsg |
errorMsg
The error message support class. |
protected static I18NHelper |
msg
I18N support |
protected boolean |
optimizeParameters
Flag indicating whether query parameers should be included. |
protected ParameterTable |
paramtab
The query parameter table |
protected PersistenceManagerInternal |
pm
The persistence manager of the query instance. |
Fields inherited from class antlr.TreeParser |
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepth |
Constructor Summary | |
Optimizer()
|
Method Summary | |
void |
binaryArithmeticExpr(antlr.collections.AST _t)
|
void |
bitwiseExpr(antlr.collections.AST _t)
|
void |
candidateClass(antlr.collections.AST _t)
|
protected JDOQLAST |
checkAnd(JDOQLAST op,
JDOQLAST left,
JDOQLAST right)
Check an AND operation (BAND, AND) for constant operands that could be optimized. |
protected JDOQLAST |
checkBinaryMinusOp(JDOQLAST op,
JDOQLAST left,
JDOQLAST right)
Check a binary minus operation (MINUS) for constant operands that could be optimized. |
protected JDOQLAST |
checkBinaryPlusOp(JDOQLAST op,
JDOQLAST left,
JDOQLAST right)
Check a binary plus operation (PLUS) for constant operands that could be optimized. |
protected JDOQLAST |
checkCollectionEqualityOp(JDOQLAST op,
JDOQLAST left,
JDOQLAST right,
boolean negate)
Check a collection equality operation (COLLECTION_EQUAL, COLLECTION_NOT_EQUAL) for constant operands that could be optimized. |
protected JDOQLAST |
checkConcatOp(JDOQLAST op,
JDOQLAST left,
JDOQLAST right)
Check a string concatenation operation (CONCAT) for constant operands that could be optimized. |
protected JDOQLAST |
checkDivisionOp(JDOQLAST op,
JDOQLAST left,
JDOQLAST right)
Check a binary division operation (DIV) for constant operands that could be optimized. |
protected JDOQLAST |
checkEqualityOp(JDOQLAST op,
JDOQLAST left,
JDOQLAST right,
boolean negate)
Check a equality operation (EQUAL, NOT_EQUAL) for constant operands that could be optimized. |
protected JDOQLAST |
checkLogicalNotOp(JDOQLAST op,
JDOQLAST arg)
Check a logical not operation (LNOT) for a constant operand that could be optimized. |
protected JDOQLAST |
checkMultiplicationOp(JDOQLAST op,
JDOQLAST left,
JDOQLAST right)
Check a binary multiplication operation (STAR) for constant operands that could be optimized. |
protected JDOQLAST |
checkObjectEqualityOp(JDOQLAST op,
JDOQLAST left,
JDOQLAST right,
boolean negate)
Check a object equality operation (OBJECT_EQUAL, OBJECT_NOT_EQUAL) for constant operands that could be optimized. |
protected JDOQLAST |
checkOr(JDOQLAST op,
JDOQLAST left,
JDOQLAST right)
Check an OR operation (BOR, OR) for constant operands that could be optimized. |
protected JDOQLAST |
checkUnaryMinusOp(JDOQLAST op,
JDOQLAST arg)
Check a unary minus operation (UNARY_MINUS) for a constant operand that could be optimized. |
void |
complementExpr(antlr.collections.AST _t)
|
void |
conditionalExpr(antlr.collections.AST _t)
|
void |
contains(antlr.collections.AST _t)
|
void |
declareParameter(antlr.collections.AST _t)
|
void |
declareVariable(antlr.collections.AST _t)
|
void |
endsWith(antlr.collections.AST _t)
|
void |
expression(antlr.collections.AST _t)
|
void |
fieldAccess(antlr.collections.AST _t)
|
void |
filter(antlr.collections.AST _t)
|
protected java.math.BigDecimal |
getBigDecimalValue(java.lang.Object value)
Converts the specified value into a BigDecimal value. |
protected java.math.BigInteger |
getBigIntegerValue(java.lang.Object value)
Converts the specified value into a BigInteger value. |
protected JDOQLAST |
handleValueEqValue(JDOQLAST op,
JDOQLAST left,
JDOQLAST right,
boolean negate)
This method is called in the case of an equality operation having two constant operands. |
void |
init(PersistenceManagerInternal pm,
ParameterTable paramtab,
ErrorMsg errorMsg)
|
void |
integralLiteral(antlr.collections.AST _t,
boolean negate)
|
protected boolean |
isBooleanValueAST(JDOQLAST ast)
Returns true if the specified AST represents a constant boolean value. |
void |
isEmpty(antlr.collections.AST _t)
|
void |
literal(antlr.collections.AST _t)
|
void |
navigation(antlr.collections.AST _t)
|
void |
ordering(antlr.collections.AST _t)
|
void |
orderSpec(antlr.collections.AST _t)
|
void |
parameterAccess(antlr.collections.AST _t)
|
void |
parameters(antlr.collections.AST _t)
|
protected static char |
parseChar(java.lang.String text)
Converts the string argument into a single char. |
void |
primary(antlr.collections.AST _t)
|
void |
query(antlr.collections.AST _t)
|
void |
relationalExpr(antlr.collections.AST _t)
|
void |
reportError(antlr.RecognitionException ex)
|
void |
reportError(java.lang.String s)
|
void |
startsWith(antlr.collections.AST _t)
|
void |
staticFieldAccess(antlr.collections.AST _t)
|
void |
unaryArithmeticExpr(antlr.collections.AST _t)
|
void |
variableAccess(antlr.collections.AST _t)
|
void |
variables(antlr.collections.AST _t)
|
Methods inherited from class antlr.TreeParser |
getAST, getASTFactory, getTokenName, getTokenNames, match, match, matchNot, panic, reportWarning, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected PersistenceManagerInternal pm
protected ErrorMsg errorMsg
protected ParameterTable paramtab
protected boolean optimizeParameters
protected static final I18NHelper msg
public static final java.lang.String[] _tokenNames
Constructor Detail |
public Optimizer()
Method Detail |
public void init(PersistenceManagerInternal pm, ParameterTable paramtab, ErrorMsg errorMsg)
public void reportError(antlr.RecognitionException ex)
public void reportError(java.lang.String s)
protected static char parseChar(java.lang.String text)
protected JDOQLAST checkAnd(JDOQLAST op, JDOQLAST left, JDOQLAST right)
op
- the AND operatorleft
- the left operandright
- the right operand
protected JDOQLAST checkOr(JDOQLAST op, JDOQLAST left, JDOQLAST right)
op
- the OR operatorleft
- the left operandright
- the right operand
protected JDOQLAST checkEqualityOp(JDOQLAST op, JDOQLAST left, JDOQLAST right, boolean negate)
op
- the equality operatorleft
- the left operandright
- the right operandnegate
- true for not equal operation, false otherwise
protected JDOQLAST checkObjectEqualityOp(JDOQLAST op, JDOQLAST left, JDOQLAST right, boolean negate)
op
- the object equality operatorleft
- the left operandright
- the right operandnegate
- true for not equal operation, false otherwise
protected JDOQLAST checkCollectionEqualityOp(JDOQLAST op, JDOQLAST left, JDOQLAST right, boolean negate)
op
- the collection equality operatorleft
- the left operandright
- the right operandnegate
- true for not equal operation, false otherwise
protected JDOQLAST checkLogicalNotOp(JDOQLAST op, JDOQLAST arg)
op
- the logical not operatorarg
- the operand
protected JDOQLAST checkBinaryPlusOp(JDOQLAST op, JDOQLAST left, JDOQLAST right)
op
- the plus operatorleft
- the left operandright
- the right operand
protected JDOQLAST checkConcatOp(JDOQLAST op, JDOQLAST left, JDOQLAST right)
op
- the concat operatorleft
- the left operandright
- the right operand
protected JDOQLAST checkBinaryMinusOp(JDOQLAST op, JDOQLAST left, JDOQLAST right)
op
- the minus operatorleft
- the left operandright
- the right operand
protected JDOQLAST checkMultiplicationOp(JDOQLAST op, JDOQLAST left, JDOQLAST right)
op
- the multiplication operatorleft
- the left operandright
- the right operand
protected JDOQLAST checkDivisionOp(JDOQLAST op, JDOQLAST left, JDOQLAST right)
op
- the division operatorleft
- the left operandright
- the right operand
protected JDOQLAST checkUnaryMinusOp(JDOQLAST op, JDOQLAST arg)
op
- the unary minus operatorarg
- the operand
protected java.math.BigDecimal getBigDecimalValue(java.lang.Object value)
value
- value to be converted
protected java.math.BigInteger getBigIntegerValue(java.lang.Object value)
value
- value to be converted
protected JDOQLAST handleValueEqValue(JDOQLAST op, JDOQLAST left, JDOQLAST right, boolean negate)
op
- the equality operatorleft
- the left operandright
- the right operandnegate
- true for not equal operation, false otherwise
protected boolean isBooleanValueAST(JDOQLAST ast)
public final void query(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void candidateClass(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void parameters(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void variables(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void ordering(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void filter(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void declareParameter(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void declareVariable(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void orderSpec(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void expression(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void primary(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void bitwiseExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void conditionalExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void relationalExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void binaryArithmeticExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void unaryArithmeticExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void complementExpr(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void integralLiteral(antlr.collections.AST _t, boolean negate) throws antlr.RecognitionException
antlr.RecognitionException
public final void literal(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void parameterAccess(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void variableAccess(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void staticFieldAccess(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void fieldAccess(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void navigation(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void contains(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void startsWith(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void endsWith(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
public final void isEmpty(antlr.collections.AST _t) throws antlr.RecognitionException
antlr.RecognitionException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |