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


Java InfixExpression.extendedOperands方法代码示例

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


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

示例1: getInversedAndOrExpression

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
private static Expression getInversedAndOrExpression(ASTRewrite rewrite, InfixExpression infixExpression, Operator newOperator, SimpleNameRenameProvider provider) {
	InfixExpression newExpression= rewrite.getAST().newInfixExpression();
	newExpression.setOperator(newOperator);

	int newOperatorPrecedence= OperatorPrecedence.getOperatorPrecedence(newOperator);
	//
	Expression leftOperand= getInversedExpression(rewrite, infixExpression.getLeftOperand(), provider);
	newExpression.setLeftOperand(parenthesizeIfRequired(leftOperand, newOperatorPrecedence));

	Expression rightOperand= getInversedExpression(rewrite, infixExpression.getRightOperand(), provider);
	newExpression.setRightOperand(parenthesizeIfRequired(rightOperand, newOperatorPrecedence));

	List<Expression> extraOperands= infixExpression.extendedOperands();
	List<Expression> newExtraOperands= newExpression.extendedOperands();
	for (int i= 0; i < extraOperands.size(); i++) {
		Expression extraOperand= getInversedExpression(rewrite, extraOperands.get(i), provider);
		newExtraOperands.add(parenthesizeIfRequired(extraOperand, newOperatorPrecedence));
	}
	return newExpression;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:AdvancedQuickAssistProcessor.java

示例2: isOperatorSelected

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
private static int isOperatorSelected(InfixExpression infixExpression, int offset, int length) {
	ASTNode left= infixExpression.getLeftOperand();
	ASTNode right= infixExpression.getRightOperand();

	if (isSelectingOperator(left, right, offset, length)) {
		return ASTNodes.getExclusiveEnd(left);
	}
	List<Expression> extended= infixExpression.extendedOperands();
	for (int i= 0; i < extended.size(); i++) {
		left= right;
		right= extended.get(i);
		if (isSelectingOperator(left, right, offset, length)) {
			return ASTNodes.getExclusiveEnd(left);
		}
	}
	return -1;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:AdvancedQuickAssistProcessor.java

示例3: breakInfixOperationAtOperation

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
private static void breakInfixOperationAtOperation(ASTRewrite rewrite, Expression expression, Operator operator, int operatorOffset, boolean removeParentheses, Expression[] res) {
	if (expression.getStartPosition() + expression.getLength() <= operatorOffset) {
		// add to the left
		res[0]= combineOperands(rewrite, res[0], expression, removeParentheses, operator);
		return;
	}
	if (operatorOffset <= expression.getStartPosition()) {
		// add to the right
		res[1]= combineOperands(rewrite, res[1], expression, removeParentheses, operator);
		return;
	}
	if (!(expression instanceof InfixExpression)) {
		throw new IllegalArgumentException("Cannot break up non-infix expression"); //$NON-NLS-1$
	}
	InfixExpression infixExpression= (InfixExpression) expression;
	if (infixExpression.getOperator() != operator) {
		throw new IllegalArgumentException("Incompatible operator"); //$NON-NLS-1$
	}
	breakInfixOperationAtOperation(rewrite, infixExpression.getLeftOperand(), operator, operatorOffset, removeParentheses, res);
	breakInfixOperationAtOperation(rewrite, infixExpression.getRightOperand(), operator, operatorOffset, removeParentheses, res);

	List<Expression> extended= infixExpression.extendedOperands();
	for (int i= 0; i < extended.size(); i++) {
		breakInfixOperationAtOperation(rewrite, extended.get(i), operator, operatorOffset, removeParentheses, res);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:AdvancedQuickAssistProcessor.java

示例4: visit

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
@Override
public boolean visit(InfixExpression node) {
	node.getLeftOperand().accept(this);
	this.fBuffer.append(' '); // for cases like x= i - -1; or x= i++ + ++i;
	this.fBuffer.append(node.getOperator().toString());
	this.fBuffer.append(' ');
	node.getRightOperand().accept(this);
	final List<Expression>extendedOperands = node.extendedOperands();
	if (extendedOperands.size() != 0) {
		this.fBuffer.append(' ');
		for (Iterator<Expression> it = extendedOperands.iterator(); it.hasNext(); ) {
			this.fBuffer.append(node.getOperator().toString()).append(' ');
			Expression e = it.next();
			e.accept(this);
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:19,代码来源:ASTFlattener.java

示例5: visit

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
public boolean visit(InfixExpression node) {
	node.getLeftOperand().accept(this);
	this.buffer.append(' ');  // for cases like x= i - -1; or x= i++ + ++i;
	this.buffer.append(node.getOperator().toString());
	this.buffer.append(' ');
	node.getRightOperand().accept(this);
	final List extendedOperands = node.extendedOperands();
	if (extendedOperands.size() != 0) {
		this.buffer.append(' ');
		for (Iterator it = extendedOperands.iterator(); it.hasNext(); ) {
			this.buffer.append(node.getOperator().toString()).append(' ');
			Expression e = (Expression) it.next();
			e.accept(this);
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:NaiveASTFlattener.java

示例6: visit

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
@Override
public boolean visit(InfixExpression node) {
    if (!(node.getOperator() == InfixExpression.Operator.PLUS && STRING_IDENTIFIER.equals(node.resolveTypeBinding()
            .getQualifiedName()))) {
        return true;
    }
    this.infixExpression = node;
    nodesBeingConcatenated.add(node.getLeftOperand());
    nodesBeingConcatenated.add(node.getRightOperand());

    @SuppressWarnings("unchecked")
    List<Expression> extendedOperations = node.extendedOperands();

    for (Expression expression : extendedOperations) {
        nodesBeingConcatenated.add(expression);
    }

    return false; // prevent traversal to any String Literals
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:20,代码来源:UseCharacterParameterizedMethodResolution.java

示例7: collectInfixPlusOperands

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
private static void collectInfixPlusOperands(Expression expression, List<Expression> collector) {
	if (expression instanceof InfixExpression && ((InfixExpression)expression).getOperator() == InfixExpression.Operator.PLUS) {
		InfixExpression infixExpression= (InfixExpression)expression;
		
		collectInfixPlusOperands(infixExpression.getLeftOperand(), collector);
		collectInfixPlusOperands(infixExpression.getRightOperand(), collector);
		List<Expression> extendedOperands= infixExpression.extendedOperands();
		for (Iterator<Expression> iter= extendedOperands.iterator(); iter.hasNext();) {
			collectInfixPlusOperands(iter.next(), collector);
		}
		
	} else {
		collector.add(expression);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:QuickAssistProcessor.java

示例8: resolveInfixExpression

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
/**
 * Resolbes Infix Expression
 * 
 * @param expression
 */
private void resolveInfixExpression(final InfixExpression expression) {
	this.resolveExpression(expression.getLeftOperand());
	this.resolveExpression(expression.getRightOperand());
	for (final Object o : expression.extendedOperands()) {
		this.resolveExpression((Expression) o);
	}

}
 
开发者ID:awltech,项目名称:eclipse-i18ntools,代码行数:14,代码来源:ASTExpressionResolver.java

示例9: write

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void write(InfixExpression infixExpression) {
	InfixExpression.Operator operator = infixExpression.getOperator();

	if (operator == InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED) {
		write("rightShiftUnsigned(");
           writeNode(infixExpression.getLeftOperand());

		// Skip spaces before the >>> but if there's a newline (or comments) there, copy them
		skipSpacesAndTabs();
		copySpaceAndComments();
		matchAndWrite(">>>", ",");

		copySpaceAndComments();
           writeNode(infixExpression.getRightOperand());
		write(")");
	}
	else {
           writeNode(infixExpression.getLeftOperand());

		copySpaceAndComments();
		String operatorToken = this.equivalentOperators.get(infixExpression.getOperator());
		matchAndWrite(operatorToken);

		copySpaceAndComments();
           writeNode(infixExpression.getRightOperand());

		if (infixExpression.hasExtendedOperands()) {
			for (Expression extendedOperand : (List<Expression>) infixExpression.extendedOperands()) {
				
				copySpaceAndComments();
				matchAndWrite(operatorToken);

				copySpaceAndComments();
                   writeNode(extendedOperand);
			}
		}
	}
}
 
开发者ID:juniversal,项目名称:juniversal,代码行数:41,代码来源:InfixExpressionWriter.java

示例10: visit

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean visit(InfixExpression node) {
    // for "Hello" + array + ':' + otherArray
    if (node.getOperator() == Operator.PLUS &&
            "java.lang.String".equals(node.resolveTypeBinding().getQualifiedName())) {
        checkOperand(node.getLeftOperand());
        checkOperand(node.getRightOperand());
        List<Expression> extendedOps = node.extendedOperands();
        for (Expression operand : extendedOps) {
            checkOperand(operand);
        }
    }
    return true;
}
 
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:16,代码来源:ArrayToStringResolution.java

示例11: write

import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void write(ASTNode node) {
	InfixExpression infixExpression = (InfixExpression) node;

       // TODO: Add spaces to left & right of binary operators if needed, per Swift's rules about needing space on
       // both sides or neither
	
	InfixExpression.Operator operator = infixExpression.getOperator();

	if (operator == InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED) {
           // TODO: Handle this
		write("rightShiftUnsigned(");
           swiftASTWriters.writeNode(infixExpression.getLeftOperand());

		// Skip spaces before the >>> but if there's a newline (or comments) there, copy them
		skipSpacesAndTabs();
		copySpaceAndComments();
		matchAndWrite(">>>", ",");

		copySpaceAndComments();
           swiftASTWriters.writeNode(infixExpression.getRightOperand());
		write(")");
	}
	else {
           swiftASTWriters.writeNode(infixExpression.getLeftOperand());

		copySpaceAndComments();
		String operatorToken = this.equivalentOperators.get(infixExpression.getOperator());
		matchAndWrite(operatorToken);

		copySpaceAndComments();
           swiftASTWriters.writeNode(infixExpression.getRightOperand());

		if (infixExpression.hasExtendedOperands()) {
			for (Expression extendedOperand : (List<Expression>) infixExpression.extendedOperands()) {
				
				copySpaceAndComments();
				matchAndWrite(operatorToken);

				copySpaceAndComments();
                   swiftASTWriters.writeNode(extendedOperand);
			}
		}
	}
}
 
开发者ID:juniversal,项目名称:juniversal,代码行数:47,代码来源:InfixExpressionWriter.java


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