本文整理汇总了Java中org.eclipse.jdt.core.dom.InfixExpression.hasExtendedOperands方法的典型用法代码示例。如果您正苦于以下问题:Java InfixExpression.hasExtendedOperands方法的具体用法?Java InfixExpression.hasExtendedOperands怎么用?Java InfixExpression.hasExtendedOperands使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.InfixExpression
的用法示例。
在下文中一共展示了InfixExpression.hasExtendedOperands方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
@Override
public void write(InfixExpression infixExpression) {
InfixExpression.Operator operator = infixExpression.getOperator();
if (operator == InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED) {
writeRightShiftUnsigned(infixExpression);
} else {
writeNode(infixExpression.getLeftOperand());
copySpaceAndComments();
String operatorToken = this.equivalentOperators.get(operator);
matchAndWrite(operatorToken);
copySpaceAndComments();
writeNode(infixExpression.getRightOperand());
if (infixExpression.hasExtendedOperands()) {
forEach(infixExpression.extendedOperands(), (Expression extendedOperand) -> {
copySpaceAndComments();
matchAndWrite(operatorToken);
copySpaceAndComments();
writeNode(extendedOperand);
});
}
}
}
示例2: writeRightShiftUnsigned
import org.eclipse.jdt.core.dom.InfixExpression; //导入方法依赖的package包/类
private void writeRightShiftUnsigned(InfixExpression infixExpression) {
ITypeBinding typeBinding = infixExpression.getLeftOperand().resolveTypeBinding();
String typeName = typeBinding.getName();
//TODO: Remove inner parens for left operand if it's a simple (single elmt) expression, not needing them
String cSharpTypeName;
String cSharpUnsignedTypeName;
if (typeBinding.getName().equals("long")) {
cSharpTypeName = "long";
cSharpUnsignedTypeName = "ulong";
} else if (typeBinding.getName().equals("int")) {
cSharpTypeName = "int";
cSharpUnsignedTypeName = "uint";
} else if (typeBinding.getName().equals("short")) {
cSharpTypeName = "short";
cSharpUnsignedTypeName = "ushort";
} else if (typeBinding.getName().equals("byte")) {
cSharpTypeName = "sbyte";
cSharpUnsignedTypeName = "byte";
}
else throw new JUniversalException("Unexpected >>> left operand type: " + typeName);
write("(" + cSharpTypeName + ")((" + cSharpUnsignedTypeName + ")(");
writeNode(infixExpression.getLeftOperand());
write(")");
copySpaceAndComments();
matchAndWrite(">>>", ">>");
copySpaceAndComments();
writeNode(infixExpression.getRightOperand());
write(")");
if (infixExpression.hasExtendedOperands())
throw sourceNotSupported(">>> extended operands (with multiple >>> operators in a row, like 'a >>> b >>> c') not currently supported");
}
示例3: 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);
}
}
}
}
示例4: 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);
}
}
}
}