本文整理汇总了Java中org.eclipse.jdt.internal.corext.dom.ASTNodes.getExclusiveEnd方法的典型用法代码示例。如果您正苦于以下问题:Java ASTNodes.getExclusiveEnd方法的具体用法?Java ASTNodes.getExclusiveEnd怎么用?Java ASTNodes.getExclusiveEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.dom.ASTNodes
的用法示例。
在下文中一共展示了ASTNodes.getExclusiveEnd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isOperatorSelected
import org.eclipse.jdt.internal.corext.dom.ASTNodes; //导入方法依赖的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;
}
示例2: isSelectingOperator
import org.eclipse.jdt.internal.corext.dom.ASTNodes; //导入方法依赖的package包/类
private static boolean isSelectingOperator(ASTNode n1, ASTNode n2, int offset, int length) {
// between the nodes
if (offset + length <= n2.getStartPosition() && offset >= ASTNodes.getExclusiveEnd(n1)) {
return true;
}
// or exactly select the node (but not with infix expressions)
if (n1.getStartPosition() == offset && ASTNodes.getExclusiveEnd(n2) == offset + length) {
if (n1 instanceof InfixExpression || n2 instanceof InfixExpression) {
return false;
}
return true;
}
return false;
}