|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.internal.compiler.ast.ASTNode
org.eclipse.jdt.internal.compiler.ast.Statement
org.eclipse.jdt.internal.compiler.ast.Expression
org.eclipse.jdt.internal.compiler.ast.OperatorExpression
org.eclipse.jdt.internal.compiler.ast.BinaryExpression
org.eclipse.jdt.internal.compiler.ast.CombinedBinaryExpression
public class CombinedBinaryExpression
CombinedBinaryExpression is an implementation of BinaryExpression that
specifically attempts to mitigate the issues raised by expressions which
have a very deep leftmost branch. It does so by maintaining a table of
direct references to its subexpressions, and implementing non-recursive
variants of the most significant recursive algorithms of its ancestors.
The subexpressions table only holds intermediate binary expressions. Its
role is to provide the reversed navigation through the left relationship
of BinaryExpression to Expression. To cope with potentially very deep
left branches, an instance of CombinedBinaryExpression is created once in
a while, using variable thresholds held by arityMax
.
As a specific case, the topmost node of all binary expressions that are
deeper than one is a CombinedBinaryExpression, but it has no references
table.
Notes:
Field Summary | |
---|---|
int |
arity
The number of consecutive binary expressions of this' left branch that bear the same operator as this. Notes: the presence of a CombinedBinaryExpression instance resets arity, even when its operator is compatible; this property is maintained by the parser. |
static int |
ARITY_MAX_MAX
Upper limit for arityMax . |
static int |
ARITY_MAX_MIN
Default lower limit for arityMax . |
int |
arityMax
The threshold that will trigger the creation of the next full-fledged CombinedBinaryExpression. |
static int |
defaultArityMaxStartingValue
Default value for the first term of the series of arityMax
values. |
BinaryExpression[] |
referencesTable
A table of references to the binary expressions of this' left branch. |
Fields inherited from class org.eclipse.jdt.internal.compiler.ast.BinaryExpression |
---|
left, optimizedBooleanConstant, right |
Fields inherited from class org.eclipse.jdt.internal.compiler.ast.OperatorExpression |
---|
OperatorSignatures |
Fields inherited from class org.eclipse.jdt.internal.compiler.ast.Expression |
---|
constant, implicitConversion, resolvedType, statementEnd |
Fields inherited from interface org.eclipse.jdt.internal.compiler.ast.OperatorIds |
---|
AND, AND_AND, DIVIDE, EQUAL, EQUAL_EQUAL, GREATER, GREATER_EQUAL, INSTANCEOF, JML_ELEMTYPE, JML_EQUIV, JML_IMPLIES, JML_NONNULLELEMENTS, JML_NOT_ASSIGNED, JML_NOT_EQUIV, JML_NOT_MODIFIED, JML_OLD, JML_PRE, JML_REPRESENTS, JML_REV_IMPLIES, JML_TYPE, JML_TYPEOF, JmlOtherOpIdStart, LEFT_SHIFT, LESS, LESS_EQUAL, MINUS, MINUS_MINUS, MULTIPLY, NOT, NOT_EQUAL, NumberOfExtraTablesForJML, NumberOfTables, OR, OR_OR, PLUS, PLUS_PLUS, QUESTIONCOLON, REMAINDER, RIGHT_SHIFT, TWIDDLE, UNSIGNED_RIGHT_SHIFT, XOR |
Constructor Summary | |
---|---|
CombinedBinaryExpression(CombinedBinaryExpression expression)
|
|
CombinedBinaryExpression(Expression left,
Expression right,
int operator,
int arity)
Make a new CombinedBinaryExpression. |
Method Summary | |
---|---|
FlowInfo |
analyseCode(BlockScope currentScope,
FlowContext flowContext,
FlowInfo flowInfo)
|
void |
generateOptimizedStringConcatenation(BlockScope blockScope,
CodeStream codeStream,
int typeID)
|
void |
generateOptimizedStringConcatenationCreation(BlockScope blockScope,
CodeStream codeStream,
int typeID)
|
java.lang.StringBuffer |
printExpressionNoParenthesis(int indent,
java.lang.StringBuffer output)
|
TypeBinding |
resolveType(BlockScope scope)
Resolve the type of this expression in the context of a blockScope |
void |
traverse(ASTVisitor visitor,
BlockScope scope)
Traverse an expression in the context of a blockScope |
void |
tuneArityMax()
Change arityMax if and as needed. |
Methods inherited from class org.eclipse.jdt.internal.compiler.ast.BinaryExpression |
---|
computeConstant, generateCode, generateLogicalAnd, generateLogicalOr, generateLogicalXor, generateOptimizedBoolean, generateOptimizedGreaterThan, generateOptimizedGreaterThanOrEqual, generateOptimizedLessThan, generateOptimizedLessThanOrEqual, generateOptimizedLogicalAnd, generateOptimizedLogicalOr, generateOptimizedLogicalXor, isCompactableOperation, optimizedBooleanConstant, optimizedBooleanConstant |
Methods inherited from class org.eclipse.jdt.internal.compiler.ast.OperatorExpression |
---|
classInitialize, generateTableTestCase, get_AND_AND, get_AND, get_DIVIDE, get_EQUAL_EQUAL, get_GREATER_EQUAL, get_GREATER, get_LEFT_SHIFT, get_LESS_EQUAL, get_LESS, get_MINUS, get_MULTIPLY, get_OR_OR, get_OR, get_PLUS, get_REMAINDER, get_RIGHT_SHIFT, get_UNSIGNED_RIGHT_SHIFT, get_XOR, nullStatus, operatorToString, printExpression |
Methods inherited from class org.eclipse.jdt.internal.compiler.ast.Expression |
---|
analyseCode, checkCastTypesCompatibility, checkNPE, checkUnsafeCast, computeConversion, generateCode, isConstantValueOfTypeAssignableToType, isConstantValueRepresentable, isDeclaredMonoNonNull, isDeclaredNonNull, isTypeReference, localVariableBinding, markAsNonNull, postConversionType, print, printStatement, resolve, resolveType, resolveTypeExpecting, reusableJSRTarget, setExpectedType, tagAsNeedCheckCast, tagAsUnnecessaryCast, toTypeReference, traverse |
Methods inherited from class org.eclipse.jdt.internal.compiler.ast.Statement |
---|
branchChainTo, complainIfUnreachable, generateArguments, isEmptyBlock, isValidJavaStatement, resolveCase |
Methods inherited from class org.eclipse.jdt.internal.compiler.ast.ASTNode |
---|
checkInvocationArguments, concreteStatement, isFieldUseDeprecated, isImplicitThis, isMethodUseDeprecated, isSuper, isThis, isTypeUseDeprecated, printAnnotations, printIndent, printModifiers, resolveAnnotations, resolveDeprecatedAnnotations, sourceEnd, sourceStart, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int arity
public int arityMax
public static final int ARITY_MAX_MAX
arityMax
.
public static final int ARITY_MAX_MIN
arityMax
.
public static int defaultArityMaxStartingValue
arityMax
values. Changing this allows for experimentation. Not meant to be
changed during a parse operation.
public BinaryExpression[] referencesTable
Constructor Detail |
---|
public CombinedBinaryExpression(Expression left, Expression right, int operator, int arity)
BinaryExpression.left
. arity and left must be
compatible with each other (that is, there must be at least arity - 1
consecutive compatible binary expressions into the leftmost branch of left,
the topmost of which being left's immediate left expression).
left
- the left branch expressionright
- the right branch expressionoperator
- the operator for this binary expression - only PLUS for nowarity
- the number of binary expressions of a compatible operator that
already exist into the leftmost branch of left (including left); must
be strictly greater than 0public CombinedBinaryExpression(CombinedBinaryExpression expression)
Method Detail |
---|
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo)
analyseCode
in class BinaryExpression
public void generateOptimizedStringConcatenation(BlockScope blockScope, CodeStream codeStream, int typeID)
generateOptimizedStringConcatenation
in class BinaryExpression
public void generateOptimizedStringConcatenationCreation(BlockScope blockScope, CodeStream codeStream, int typeID)
generateOptimizedStringConcatenationCreation
in class BinaryExpression
public java.lang.StringBuffer printExpressionNoParenthesis(int indent, java.lang.StringBuffer output)
printExpressionNoParenthesis
in class BinaryExpression
public TypeBinding resolveType(BlockScope scope)
Expression
resolveType
in class BinaryExpression
public void traverse(ASTVisitor visitor, BlockScope scope)
Expression
traverse
in class BinaryExpression
public void tuneArityMax()
arityMax
if and as needed. The current policy is to double
arityMax each time this method is called, until it reaches
ARITY_MAX_MAX
. Other policies may consider incrementing it less
agressively. Call only after an appropriate value has been assigned to
BinaryExpression.left
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |