本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.OperatorIds.XOR属性的典型用法代码示例。如果您正苦于以下问题:Java OperatorIds.XOR属性的具体用法?Java OperatorIds.XOR怎么用?Java OperatorIds.XOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.internal.compiler.ast.OperatorIds
的用法示例。
在下文中一共展示了OperatorIds.XOR属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: longToIntForHashCode
/** 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;
}
示例2: longToIntForHashCode
/** 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;
}
示例3: visit
/**
* @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();
}
}
示例4: visit
public boolean visit(BinaryExpression binaryExpression, BlockScope scope) {
if (binaryExpression instanceof CombinedBinaryExpression) {
CombinedBinaryExpression expression = (CombinedBinaryExpression) binaryExpression;
if (expression.referencesTable != null) {
return this.visit(expression, scope);
}
}
final int numberOfParens = (binaryExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
if (numberOfParens > 0) {
addRealFragment(binaryExpression);
} else {
switch((binaryExpression.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT) {
case OperatorIds.PLUS :
if (buildFragments(binaryExpression)) {
binaryExpression.left.traverse(this, scope);
this.operatorsList.add(new Integer(TerminalTokens.TokenNamePLUS));
binaryExpression.right.traverse(this, scope);
}
return false;
case OperatorIds.MINUS :
if (buildFragments(binaryExpression)) {
binaryExpression.left.traverse(this, scope);
this.operatorsList.add(new Integer(TerminalTokens.TokenNameMINUS));
binaryExpression.right.traverse(this, scope);
}
return false;
case OperatorIds.MULTIPLY :
if (buildFragments(binaryExpression)) {
binaryExpression.left.traverse(this, scope);
this.operatorsList.add(new Integer(TerminalTokens.TokenNameMULTIPLY));
binaryExpression.right.traverse(this, scope);
}
return false;
case OperatorIds.REMAINDER :
if (buildFragments(binaryExpression)) {
binaryExpression.left.traverse(this, scope);
this.operatorsList.add(new Integer(TerminalTokens.TokenNameREMAINDER));
binaryExpression.right.traverse(this, scope);
}
return false;
case OperatorIds.XOR :
if (buildFragments(binaryExpression)) {
binaryExpression.left.traverse(this, scope);
this.operatorsList.add(new Integer(TerminalTokens.TokenNameXOR));
binaryExpression.right.traverse(this, scope);
}
return false;
case OperatorIds.DIVIDE :
if (buildFragments(binaryExpression)) {
binaryExpression.left.traverse(this, scope);
this.operatorsList.add(new Integer(TerminalTokens.TokenNameDIVIDE));
binaryExpression.right.traverse(this, scope);
}
return false;
case OperatorIds.OR :
if (buildFragments(binaryExpression)) {
binaryExpression.left.traverse(this, scope);
this.operatorsList.add(new Integer(TerminalTokens.TokenNameOR));
binaryExpression.right.traverse(this, scope);
}
return false;
case OperatorIds.AND :
if (buildFragments(binaryExpression)) {
binaryExpression.left.traverse(this, scope);
this.operatorsList.add(new Integer(TerminalTokens.TokenNameAND));
binaryExpression.right.traverse(this, scope);
}
return false;
default:
addRealFragment(binaryExpression);
}
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:74,代码来源:BinaryExpressionFragmentBuilder.java
示例5: buildFragments
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;
}
示例6: endVisit
@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);
}