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


Java PrefixExpression.getOperand方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.PrefixExpression.getOperand方法的典型用法代码示例。如果您正苦于以下问题:Java PrefixExpression.getOperand方法的具体用法?Java PrefixExpression.getOperand怎么用?Java PrefixExpression.getOperand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.dom.PrefixExpression的用法示例。


在下文中一共展示了PrefixExpression.getOperand方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import org.eclipse.jdt.core.dom.PrefixExpression; //导入方法依赖的package包/类
@Override
public boolean visit(PrefixExpression exp) {
	if(exp.getOperand() instanceof SimpleName) {
		String varName = exp.getOperand().toString(); 
		VariableOperation op = null;
		if(exp.getOperator() == PrefixExpression.Operator.INCREMENT)
			op = new VariableOperation(varName, VariableOperation.Type.INC);

		else if(exp.getOperator() == PrefixExpression.Operator.DECREMENT)
			op = new VariableOperation(varName, VariableOperation.Type.DEC);

		if(op != null)
			current.addOperation(op);
	}
	return true;
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:17,代码来源:VarParser.java

示例2: getNumber

import org.eclipse.jdt.core.dom.PrefixExpression; //导入方法依赖的package包/类
protected String getNumber(PrefixExpression prefixExpression) {
String number = null;

Expression operand = prefixExpression.getOperand();
if (operand.getNodeType() == ASTNode.NUMBER_LITERAL) {
    org.eclipse.jdt.core.dom.PrefixExpression.Operator operator = prefixExpression
	    .getOperator();

    if (org.eclipse.jdt.core.dom.PrefixExpression.Operator.MINUS
	    .equals(operator)) {
	number = "-" + operand.toString();
    } else if (org.eclipse.jdt.core.dom.PrefixExpression.Operator.PLUS
	    .equals(operator)
	    || org.eclipse.jdt.core.dom.PrefixExpression.Operator.DECREMENT
		    .equals(operator)
	    || org.eclipse.jdt.core.dom.PrefixExpression.Operator.INCREMENT
		    .equals(operator)) {
	number = operand.toString();
    } else {
	number = "0";
    }

}

return number;
   }
 
开发者ID:junit-tools-team,项目名称:junit-tools,代码行数:27,代码来源:TestCasesGenerator.java

示例3: visit

import org.eclipse.jdt.core.dom.PrefixExpression; //导入方法依赖的package包/类
@Override
public boolean visit(PrefixExpression node) {
  Expression operand = node.getOperand();
  if (!considerBinding(resolveBinding(operand), operand)) return true;

  PrefixExpression.Operator operator = node.getOperator();
  if (operator != PrefixExpression.Operator.INCREMENT
      && operator != PrefixExpression.Operator.DECREMENT) return true;

  checkParent(node);

  fRewriter.replace(
      node,
      createInvocation(node.getAST(), node.getOperand(), node.getOperator().toString()),
      createGroupDescription(PREFIX_ACCESS));
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:AccessAnalyzer.java

示例4: visit

import org.eclipse.jdt.core.dom.PrefixExpression; //导入方法依赖的package包/类
@Override
public boolean visit(PrefixExpression prefixExpression) {
	if (prefixExpression.getOperand() == null)
		return true;
	if (! (prefixExpression.getOperand() instanceof SimpleName))
		return true;
	if (! prefixExpression.getOperator().equals(Operator.DECREMENT) &&
		! prefixExpression.getOperator().equals(Operator.INCREMENT))
		return true;
	SimpleName simpleName= (SimpleName)prefixExpression.getOperand();
	if (! isNameReferenceToTemp(simpleName))
		return true;

	fFirstAssignment= prefixExpression;
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:TempAssignmentFinder.java

示例5: visit

import org.eclipse.jdt.core.dom.PrefixExpression; //导入方法依赖的package包/类
@Override
public boolean visit(PrefixExpression node) {
	Expression operand= node.getOperand();
	if (!considerBinding(resolveBinding(operand), operand))
		return true;

	PrefixExpression.Operator operator= node.getOperator();
	if (operator != PrefixExpression.Operator.INCREMENT && operator != PrefixExpression.Operator.DECREMENT)
		return true;

	checkParent(node);

	fRewriter.replace(node,
		createInvocation(node.getAST(), node.getOperand(), node.getOperator().toString()),
		createGroupDescription(PREFIX_ACCESS));
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:AccessAnalyzer.java

示例6: setPrefixExpression

import org.eclipse.jdt.core.dom.PrefixExpression; //导入方法依赖的package包/类
/**
 * @param expression
 */
public void setPrefixExpression(PrefixExpression expression) {
    this.prefixExpressions.add(expression);
    Expression operand = expression.getOperand();
    expressionPrefixes.put(operand, expression.getOperator());
    analyze(operand);
}
 
开发者ID:junit-tools-team,项目名称:junit-tools,代码行数:10,代码来源:TestCasesGenerator.java

示例7: visit

import org.eclipse.jdt.core.dom.PrefixExpression; //导入方法依赖的package包/类
@Override
public boolean visit(PrefixExpression prefixExpression) {
  if (prefixExpression.getOperand() == null) return true;
  if (!(prefixExpression.getOperand() instanceof SimpleName)) return true;
  if (!prefixExpression.getOperator().equals(Operator.DECREMENT)
      && !prefixExpression.getOperator().equals(Operator.INCREMENT)) return true;
  SimpleName simpleName = (SimpleName) prefixExpression.getOperand();
  if (!isNameReferenceToTemp(simpleName)) return true;

  fFirstAssignment = prefixExpression;
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:TempAssignmentFinder.java

示例8: retrieveVariableReference

import org.eclipse.jdt.core.dom.PrefixExpression; //导入方法依赖的package包/类
private VariableReference retrieveVariableReference(PrefixExpression prefixExpr,
        Class<?> numberClass) {
	if (prefixExpr.getOperator() == org.eclipse.jdt.core.dom.PrefixExpression.Operator.MINUS) {
		NumberLiteral numberLiteral = (NumberLiteral) prefixExpr.getOperand();
		Number value = (Number) numberLiteral.resolveConstantExpressionValue();
		value = negate(value);
		PrimitiveStatement<?> numberAssignment = createPrimitiveStatement(numberClass,
		                                                                  value);
		testCase.addStatement(numberAssignment);
		return numberAssignment.getReturnValue();
	}
	throw new UnsupportedOperationException("Prefix " + prefixExpr
	        + " not implemented!");
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:15,代码来源:TestExtractingVisitor.java


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