本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.BinaryExpression类的典型用法代码示例。如果您正苦于以下问题:Java BinaryExpression类的具体用法?Java BinaryExpression怎么用?Java BinaryExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BinaryExpression类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了BinaryExpression类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: longToIntForHashCode
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
/** Give 2 clones! */
public Expression longToIntForHashCode(Expression ref1, Expression ref2, ASTNode source) {
int pS = source.sourceStart, pE = source.sourceEnd;
/* (int)(ref >>> 32 ^ ref) */
IntLiteral int32 = makeIntLiteral("32".toCharArray(), source);
BinaryExpression higherBits = new BinaryExpression(ref1, int32, OperatorIds.UNSIGNED_RIGHT_SHIFT);
setGeneratedBy(higherBits, source);
BinaryExpression xorParts = new BinaryExpression(ref2, higherBits, OperatorIds.XOR);
setGeneratedBy(xorParts, source);
TypeReference intRef = TypeReference.baseTypeReference(TypeIds.T_int, 0);
intRef.sourceStart = pS; intRef.sourceEnd = pE;
setGeneratedBy(intRef, source);
CastExpression expr = makeCastExpression(xorParts, intRef, source);
expr.sourceStart = pS; expr.sourceEnd = pE;
return expr;
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:17,代码来源:HandleEqualsAndHashCode.java
示例2: visit
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
public boolean visit(CombinedBinaryExpression combinedBinaryExpression, BlockScope scope) {
// keep implementation in sync with BinaryExpression#resolveType
if (combinedBinaryExpression.referencesTable == null) {
addRealFragment(combinedBinaryExpression.left);
this.operatorsList.add(new Integer(TerminalTokens.TokenNamePLUS));
addRealFragment(combinedBinaryExpression.right);
return false;
}
BinaryExpression cursor = combinedBinaryExpression.referencesTable[0];
if (cursor.left instanceof CombinedBinaryExpression) {
this.visit((CombinedBinaryExpression) cursor.left, scope);
} else {
addRealFragment(cursor.left);
}
for (int i = 0, end = combinedBinaryExpression.arity; i < end; i ++) {
this.operatorsList.add(new Integer(TerminalTokens.TokenNamePLUS));
addRealFragment(combinedBinaryExpression.referencesTable[i].right);
}
this.operatorsList.add(new Integer(TerminalTokens.TokenNamePLUS));
addRealFragment(combinedBinaryExpression.right);
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:BinaryExpressionFragmentBuilder.java
示例3: invalidOperator
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
public void invalidOperator(BinaryExpression expression, TypeBinding leftType, TypeBinding rightType) {
String leftName = new String(leftType.readableName());
String rightName = new String(rightType.readableName());
String leftShortName = new String(leftType.shortReadableName());
String rightShortName = new String(rightType.shortReadableName());
if (leftShortName.equals(rightShortName)){
leftShortName = leftName;
rightShortName = rightName;
}
this.handle(
IProblem.InvalidOperator,
new String[] {
expression.operatorToString(),
leftName + ", " + rightName}, //$NON-NLS-1$
new String[] {
expression.operatorToString(),
leftShortName + ", " + rightShortName}, //$NON-NLS-1$
expression.sourceStart,
expression.sourceEnd);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ProblemReporter.java
示例4: longToIntForHashCode
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
/** Give 2 clones! */
private Expression longToIntForHashCode(Expression ref1, Expression ref2, ASTNode source) {
int pS = source.sourceStart, pE = source.sourceEnd;
/* (int)(ref >>> 32 ^ ref) */
IntLiteral int32 = makeIntLiteral("32".toCharArray(), source);
BinaryExpression higherBits = new BinaryExpression(ref1, int32, OperatorIds.UNSIGNED_RIGHT_SHIFT);
setGeneratedBy(higherBits, source);
BinaryExpression xorParts = new BinaryExpression(ref2, higherBits, OperatorIds.XOR);
setGeneratedBy(xorParts, source);
TypeReference intRef = TypeReference.baseTypeReference(TypeIds.T_int, 0);
intRef.sourceStart = pS; intRef.sourceEnd = pE;
setGeneratedBy(intRef, source);
CastExpression expr = makeCastExpression(xorParts, intRef, source);
expr.sourceStart = pS; expr.sourceEnd = pE;
return expr;
}
开发者ID:redundent,项目名称:lombok,代码行数:17,代码来源:HandleEqualsAndHashCode.java
示例5: dumpEqualityExpression
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
private boolean dumpEqualityExpression(
BinaryExpression binaryExpression,
int operator,
BlockScope scope) {
final int numberOfParens = (binaryExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
if (numberOfParens > 0) {
manageOpeningParenthesizedExpression(binaryExpression, numberOfParens);
}
if (this.expressionsDepth < 0) {
this.expressionsDepth = 0;
} else {
this.expressionsDepth++;
this.expressionsPos <<= 2;
}
try {
this.expressionsPos |= EXPRESSIONS_POS_ENTER_EQUALITY;
binaryExpression.left.traverse(this, scope);
this.scribe.printNextToken(operator, this.preferences.insert_space_before_binary_operator, Scribe.PRESERVE_EMPTY_LINES_IN_EQUALITY_EXPRESSION);
if (this.preferences.insert_space_after_binary_operator) {
this.scribe.space();
}
binaryExpression.right.traverse(this, scope);
}
finally {
this.expressionsDepth--;
this.expressionsPos >>= 2;
}
if (numberOfParens > 0) {
manageClosingParenthesizedExpression(binaryExpression, numberOfParens);
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:CodeFormatterVisitor.java
示例6: visit
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
/**
* @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.BinaryExpression, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
*/
public boolean visit(BinaryExpression binaryExpression, BlockScope scope) {
switch((binaryExpression.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT) {
case OperatorIds.AND :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameAND, scope);
case OperatorIds.DIVIDE :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameDIVIDE, scope);
case OperatorIds.GREATER :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameGREATER, scope);
case OperatorIds.GREATER_EQUAL :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameGREATER_EQUAL, scope);
case OperatorIds.LEFT_SHIFT :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameLEFT_SHIFT, scope);
case OperatorIds.LESS :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameLESS, scope);
case OperatorIds.LESS_EQUAL :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameLESS_EQUAL, scope);
case OperatorIds.MINUS :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameMINUS, scope);
case OperatorIds.MULTIPLY :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameMULTIPLY, scope);
case OperatorIds.OR :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameOR, scope);
case OperatorIds.PLUS :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNamePLUS, scope);
case OperatorIds.REMAINDER :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameREMAINDER, scope);
case OperatorIds.RIGHT_SHIFT :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameRIGHT_SHIFT, scope);
case OperatorIds.UNSIGNED_RIGHT_SHIFT :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameUNSIGNED_RIGHT_SHIFT, scope);
case OperatorIds.XOR :
return dumpBinaryExpression(binaryExpression, TerminalTokens.TokenNameXOR, scope);
default:
throw new IllegalStateException();
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:41,代码来源:CodeFormatterVisitor.java
示例7: visit
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
@Override public boolean visit(BinaryExpression node, BlockScope scope) {
fixPositions(setGeneratedBy(node, source));
return super.visit(node, scope);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:5,代码来源:SetGeneratedByVisitor.java
示例8: buildFragments
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
private BinaryExpressionFragmentBuilder buildFragments(BinaryExpression binaryExpression, BlockScope scope) {
BinaryExpressionFragmentBuilder builder = new BinaryExpressionFragmentBuilder();
if (binaryExpression instanceof CombinedBinaryExpression) {
binaryExpression.traverse(builder, scope);
return builder;
}
switch((binaryExpression.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT) {
case OperatorIds.MULTIPLY :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNameMULTIPLY));
binaryExpression.right.traverse(builder, scope);
break;
case OperatorIds.PLUS :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNamePLUS));
binaryExpression.right.traverse(builder, scope);
break;
case OperatorIds.DIVIDE :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNameDIVIDE));
binaryExpression.right.traverse(builder, scope);
break;
case OperatorIds.REMAINDER :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNameREMAINDER));
binaryExpression.right.traverse(builder, scope);
break;
case OperatorIds.XOR :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNameXOR));
binaryExpression.right.traverse(builder, scope);
break;
case OperatorIds.MINUS :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNameMINUS));
binaryExpression.right.traverse(builder, scope);
break;
case OperatorIds.OR :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNameOR));
binaryExpression.right.traverse(builder, scope);
break;
case OperatorIds.AND :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNameAND));
binaryExpression.right.traverse(builder, scope);
break;
case OperatorIds.AND_AND :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNameAND_AND));
binaryExpression.right.traverse(builder, scope);
break;
case OperatorIds.OR_OR :
binaryExpression.left.traverse(builder, scope);
builder.operatorsList.add(new Integer(TerminalTokens.TokenNameOR_OR));
binaryExpression.right.traverse(builder, scope);
break;
}
return builder;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:63,代码来源:CodeFormatterVisitor.java
示例9: endVisit
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
@Override
public void endVisit(BinaryExpression x, BlockScope scope) {
JBinaryOperator op;
int binOp = (x.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT;
switch (binOp) {
case OperatorIds.LEFT_SHIFT:
op = JBinaryOperator.SHL;
break;
case OperatorIds.RIGHT_SHIFT:
op = JBinaryOperator.SHR;
break;
case OperatorIds.UNSIGNED_RIGHT_SHIFT:
op = JBinaryOperator.SHRU;
break;
case OperatorIds.PLUS:
if (javaLangString == typeMap.get(x.resolvedType)) {
op = JBinaryOperator.CONCAT;
} else {
op = JBinaryOperator.ADD;
}
break;
case OperatorIds.MINUS:
op = JBinaryOperator.SUB;
break;
case OperatorIds.REMAINDER:
op = JBinaryOperator.MOD;
break;
case OperatorIds.XOR:
op = JBinaryOperator.BIT_XOR;
break;
case OperatorIds.AND:
op = JBinaryOperator.BIT_AND;
break;
case OperatorIds.MULTIPLY:
op = JBinaryOperator.MUL;
break;
case OperatorIds.OR:
op = JBinaryOperator.BIT_OR;
break;
case OperatorIds.DIVIDE:
op = JBinaryOperator.DIV;
break;
case OperatorIds.LESS_EQUAL:
op = JBinaryOperator.LTE;
break;
case OperatorIds.GREATER_EQUAL:
op = JBinaryOperator.GTE;
break;
case OperatorIds.GREATER:
op = JBinaryOperator.GT;
break;
case OperatorIds.LESS:
op = JBinaryOperator.LT;
break;
default:
throw translateException(x, new InternalCompilerException(
"Unexpected operator for BinaryExpression"));
}
pushBinaryOp(x, op);
}
开发者ID:WeTheInternet,项目名称:xapi,代码行数:61,代码来源:GwtAstBuilder.java
示例10: pushBinaryOp
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
protected void pushBinaryOp(BinaryExpression x, JBinaryOperator op) {
pushBinaryOp(x, op, x.left, x.right);
}
开发者ID:WeTheInternet,项目名称:xapi,代码行数:4,代码来源:GwtAstBuilder.java
示例11: visit
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; //导入依赖的package包/类
@Override public boolean visit(BinaryExpression node, BlockScope scope) {
setGeneratedBy(node, source);
applyOffsetExpression(node);
return super.visit(node, scope);
}
开发者ID:redundent,项目名称:lombok,代码行数:6,代码来源:SetGeneratedByVisitor.java
注:本文中的org.eclipse.jdt.internal.compiler.ast.BinaryExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论