当前位置: 首页>>代码示例>>Java>>正文


Java Assignment.Operator方法代码示例

本文整理汇总了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?
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:InferTypeArgumentsConstraintCreator.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:38,代码来源:ASTNodes.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:AdvancedQuickAssistProcessor.java

示例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());
}
 
开发者ID:juniversal,项目名称:juniversal,代码行数:36,代码来源:AssignmentWriter.java

示例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;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:49,代码来源:ASTNodes.java

示例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;
}
 
开发者ID:ponder-lab,项目名称:Constants-to-Enum-Eclipse-Plugin,代码行数:7,代码来源:Util.java

示例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());
    }
}
 
开发者ID:juniversal,项目名称:juniversal,代码行数:50,代码来源:AssignmentWriter.java


注:本文中的org.eclipse.jdt.core.dom.Assignment.Operator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。