本文整理汇总了Java中org.eclipse.jdt.core.dom.Assignment.Operator方法的典型用法代码示例。如果您正苦于以下问题:Java Assignment.Operator方法的具体用法?Java Assignment.Operator怎么用?Java Assignment.Operator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.Assignment
的用法示例。
在下文中一共展示了Assignment.Operator方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endVisit
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
@Override
public void endVisit(Assignment node) {
Expression lhs= node.getLeftHandSide();
Expression rhs= node.getRightHandSide();
ConstraintVariable2 left= getConstraintVariable(lhs);
ConstraintVariable2 right= getConstraintVariable(rhs);
if (node.resolveBoxing()) {
ImmutableTypeVariable2 boxed= fTCModel.makeImmutableTypeVariable(node.resolveTypeBinding(), node);
setConstraintVariable(node, boxed);
} else {
setConstraintVariable(node, left); // type of assignement is type of 'left'
}
if (left == null || right == null)
return;
Assignment.Operator op= node.getOperator();
if (op == Assignment.Operator.PLUS_ASSIGN && (lhs.resolveTypeBinding() == node.getAST().resolveWellKnownType("java.lang.String"))) { //$NON-NLS-1$
//Special handling for automatic String conversion: do nothing; the RHS can be anything.
} else {
fTCModel.createElementEqualsConstraints(left, right);
fTCModel.createSubtypeConstraint(right, left); // left= right; --> [right] <= [left]
}
//TODO: other implicit conversions: numeric promotion, autoboxing?
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:InferTypeArgumentsConstraintCreator.java
示例2: endVisit
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
@Override
public void endVisit(Assignment node) {
Expression lhs = node.getLeftHandSide();
Expression rhs = node.getRightHandSide();
ConstraintVariable2 left = getConstraintVariable(lhs);
ConstraintVariable2 right = getConstraintVariable(rhs);
if (node.resolveBoxing()) {
ImmutableTypeVariable2 boxed =
fTCModel.makeImmutableTypeVariable(node.resolveTypeBinding(), node);
setConstraintVariable(node, boxed);
} else {
setConstraintVariable(node, left); // type of assignement is type of 'left'
}
if (left == null || right == null) return;
Assignment.Operator op = node.getOperator();
if (op == Assignment.Operator.PLUS_ASSIGN
&& (lhs.resolveTypeBinding()
== node.getAST().resolveWellKnownType("java.lang.String"))) { // $NON-NLS-1$
// Special handling for automatic String conversion: do nothing; the RHS can be anything.
} else {
fTCModel.createElementEqualsConstraints(left, right);
fTCModel.createSubtypeConstraint(right, left); // left= right; --> [right] <= [left]
}
// TODO: other implicit conversions: numeric promotion, autoboxing?
}
示例3: convertToInfixOperator
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
public static InfixExpression.Operator convertToInfixOperator(Assignment.Operator operator) {
if (operator.equals(Assignment.Operator.PLUS_ASSIGN))
return InfixExpression.Operator.PLUS;
if (operator.equals(Assignment.Operator.MINUS_ASSIGN))
return InfixExpression.Operator.MINUS;
if (operator.equals(Assignment.Operator.TIMES_ASSIGN))
return InfixExpression.Operator.TIMES;
if (operator.equals(Assignment.Operator.DIVIDE_ASSIGN))
return InfixExpression.Operator.DIVIDE;
if (operator.equals(Assignment.Operator.BIT_AND_ASSIGN))
return InfixExpression.Operator.AND;
if (operator.equals(Assignment.Operator.BIT_OR_ASSIGN))
return InfixExpression.Operator.OR;
if (operator.equals(Assignment.Operator.BIT_XOR_ASSIGN))
return InfixExpression.Operator.XOR;
if (operator.equals(Assignment.Operator.REMAINDER_ASSIGN))
return InfixExpression.Operator.REMAINDER;
if (operator.equals(Assignment.Operator.LEFT_SHIFT_ASSIGN))
return InfixExpression.Operator.LEFT_SHIFT;
if (operator.equals(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN))
return InfixExpression.Operator.RIGHT_SHIFT_SIGNED;
if (operator.equals(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN))
return InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED;
Assert.isTrue(false, "Cannot convert assignment operator"); //$NON-NLS-1$
return null;
}
示例4: createAssignmentStatement
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
private static Statement createAssignmentStatement(ASTRewrite rewrite, Assignment.Operator assignmentOperator, Expression origAssignee, Expression origAssigned) {
AST ast= rewrite.getAST();
Assignment elseAssignment= ast.newAssignment();
elseAssignment.setOperator(assignmentOperator);
elseAssignment.setLeftHandSide((Expression) rewrite.createCopyTarget(origAssignee));
elseAssignment.setRightHandSide((Expression) rewrite.createCopyTarget(origAssigned));
ExpressionStatement statement= ast.newExpressionStatement(elseAssignment);
return statement;
}
示例5: write
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
@Override
public void write(Assignment assignment) {
Assignment.Operator operator = assignment.getOperator();
writeNode(assignment.getLeftHandSide());
copySpaceAndComments();
if (operator == Assignment.Operator.ASSIGN)
matchAndWrite("=");
else if (operator == Assignment.Operator.PLUS_ASSIGN)
matchAndWrite("+=");
else if (operator == Assignment.Operator.MINUS_ASSIGN)
matchAndWrite("-=");
else if (operator == Assignment.Operator.TIMES_ASSIGN)
matchAndWrite("*=");
else if (operator == Assignment.Operator.DIVIDE_ASSIGN)
matchAndWrite("/=");
else if (operator == Assignment.Operator.BIT_AND_ASSIGN)
matchAndWrite("&=");
else if (operator == Assignment.Operator.BIT_OR_ASSIGN)
matchAndWrite("|=");
else if (operator == Assignment.Operator.BIT_XOR_ASSIGN)
matchAndWrite("^=");
else if (operator == Assignment.Operator.REMAINDER_ASSIGN)
matchAndWrite("%=");
else if (operator == Assignment.Operator.LEFT_SHIFT_ASSIGN)
matchAndWrite("<<=");
else if (operator == Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN)
matchAndWrite(">>=");
else if (operator == Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN)
throw sourceNotSupported(">>>= operator not supported; change Java of the form 'a >>>= b' to 'a = a >>> b' instead, which is supported");
copySpaceAndComments();
writeNode(assignment.getRightHandSide());
}
示例6: convertToInfixOperator
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
public static InfixExpression.Operator convertToInfixOperator(Assignment.Operator operator) {
if (operator.equals(Assignment.Operator.PLUS_ASSIGN)) {
return InfixExpression.Operator.PLUS;
}
if (operator.equals(Assignment.Operator.MINUS_ASSIGN)) {
return InfixExpression.Operator.MINUS;
}
if (operator.equals(Assignment.Operator.TIMES_ASSIGN)) {
return InfixExpression.Operator.TIMES;
}
if (operator.equals(Assignment.Operator.DIVIDE_ASSIGN)) {
return InfixExpression.Operator.DIVIDE;
}
if (operator.equals(Assignment.Operator.BIT_AND_ASSIGN)) {
return InfixExpression.Operator.AND;
}
if (operator.equals(Assignment.Operator.BIT_OR_ASSIGN)) {
return InfixExpression.Operator.OR;
}
if (operator.equals(Assignment.Operator.BIT_XOR_ASSIGN)) {
return InfixExpression.Operator.XOR;
}
if (operator.equals(Assignment.Operator.REMAINDER_ASSIGN)) {
return InfixExpression.Operator.REMAINDER;
}
if (operator.equals(Assignment.Operator.LEFT_SHIFT_ASSIGN)) {
return InfixExpression.Operator.LEFT_SHIFT;
}
if (operator.equals(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN)) {
return InfixExpression.Operator.RIGHT_SHIFT_SIGNED;
}
if (operator.equals(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN)) {
return InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED;
}
Assert.isTrue(false, "Cannot convert assignment operator"); //$NON-NLS-1$
return null;
}
示例7: isSuspiciousAssignmentOperator
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
public static boolean isSuspiciousAssignmentOperator(Assignment.Operator op) {
return false;
// op == Assignment.Operator.BIT_AND_ASSIGN ||
// op == Assignment.Operator.BIT_OR_ASSIGN ||
// op == Assignment.Operator.BIT_XOR_ASSIGN;
}
示例8: write
import org.eclipse.jdt.core.dom.Assignment; //导入方法依赖的package包/类
@Override
public void write(Assignment assignment) {
Assignment.Operator operator = assignment.getOperator();
if (operator == Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN) {
writeNode(assignment.getLeftHandSide());
copySpaceAndComments();
matchAndWrite(">>>=", "=");
copySpaceAndComments();
write("rightShiftUnsigned(");
writeNodeAtDifferentPosition(assignment.getLeftHandSide());
write(", ");
writeNode(assignment.getRightHandSide());
write(")");
} else {
writeNode(assignment.getLeftHandSide());
copySpaceAndComments();
if (operator == Assignment.Operator.ASSIGN)
matchAndWrite("=");
else if (operator == Assignment.Operator.PLUS_ASSIGN)
matchAndWrite("+=");
else if (operator == Assignment.Operator.MINUS_ASSIGN)
matchAndWrite("-=");
else if (operator == Assignment.Operator.TIMES_ASSIGN)
matchAndWrite("*=");
else if (operator == Assignment.Operator.DIVIDE_ASSIGN)
matchAndWrite("/=");
else if (operator == Assignment.Operator.BIT_AND_ASSIGN)
matchAndWrite("&=");
else if (operator == Assignment.Operator.BIT_OR_ASSIGN)
matchAndWrite("|=");
else if (operator == Assignment.Operator.BIT_XOR_ASSIGN)
matchAndWrite("^=");
else if (operator == Assignment.Operator.REMAINDER_ASSIGN)
matchAndWrite("%=");
else if (operator == Assignment.Operator.LEFT_SHIFT_ASSIGN)
matchAndWrite("<<=");
else if (operator == Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN)
matchAndWrite(">>=");
else if (operator == Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN)
matchAndWrite(">>>=");
copySpaceAndComments();
writeNode(assignment.getRightHandSide());
}
}