|
|||||||||||
| 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 org.apache.jdo.util.I18NHelper |
msg
I18N support |
protected boolean |
optimizeParameters
Flag indicating whether query parameers should be included. |
protected ParameterTable |
paramtab
The query parameter table |
protected org.apache.jdo.pm.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)
|
private java.lang.reflect.Field |
getAccessibleField(org.apache.jdo.model.java.JavaField javaField)
Method executing TypeSupport.getAccessibleField in a doPrivileged block. |
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. |
private java.lang.Object |
getFieldValue(org.apache.jdo.model.java.JavaField javaField,
org.apache.jdo.pm.PersistenceManagerInternal pm,
java.lang.Object object)
Returns the value of the specified field of the specified object. |
private java.lang.Object |
getStaticFieldValue(org.apache.jdo.model.java.JavaField javaField)
Returns the value of the specified static field. |
private JDOQLAST |
handleBooleanValueEqExpr(JDOQLAST op,
java.lang.Object value,
JDOQLAST expr,
boolean negate)
This method is called in the case of an equality operation having a boolean constant operand and a non constant operand. |
private JDOQLAST |
handleValueAndExpr(JDOQLAST op,
java.lang.Object value,
JDOQLAST expr)
This method is called in the case of an AND operation having at least one constant operand. |
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. |
private JDOQLAST |
handleValueOrExpr(JDOQLAST op,
java.lang.Object value,
JDOQLAST expr)
This method is called in the case of an OR operation having at least one constant operand. |
void |
init(org.apache.jdo.pm.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)
|
private java.lang.String |
skipLongTypeSuffix(java.lang.String txt)
Returns the specified string w/o a long type suffix 'l' or 'L' or the specified string if there is no such suffix. |
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 org.apache.jdo.pm.PersistenceManagerInternal pm
protected ErrorMsg errorMsg
protected ParameterTable paramtab
protected boolean optimizeParameters
protected static final org.apache.jdo.util.I18NHelper msg
public static final java.lang.String[] _tokenNames
| Constructor Detail |
public Optimizer()
| Method Detail |
public void init(org.apache.jdo.pm.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
private JDOQLAST handleBooleanValueEqExpr(JDOQLAST op,
java.lang.Object value,
JDOQLAST expr,
boolean negate)
op - the equality operatorvalue - the contant boolean valueexpr - the non constant operandnegate - true for not equal operation, false otherwise
private JDOQLAST handleValueAndExpr(JDOQLAST op,
java.lang.Object value,
JDOQLAST expr)
op - the AND operatorvalue - the value of the contsnat operandexpr - the other operand
private JDOQLAST handleValueOrExpr(JDOQLAST op,
java.lang.Object value,
JDOQLAST expr)
op - the AND operatorvalue - the value of the constant operandexpr - the other operand
protected boolean isBooleanValueAST(JDOQLAST ast)
private java.lang.String skipLongTypeSuffix(java.lang.String txt)
private java.lang.Object getFieldValue(org.apache.jdo.model.java.JavaField javaField,
org.apache.jdo.pm.PersistenceManagerInternal pm,
java.lang.Object object)
javaField - the field representationpm - the pm used in case of a managed field of a persistent instanceobject - the instance
private java.lang.Object getStaticFieldValue(org.apache.jdo.model.java.JavaField javaField)
javaField - the field representation
private java.lang.reflect.Field getAccessibleField(org.apache.jdo.model.java.JavaField javaField)
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 | ||||||||||