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


Java Operator.LESS属性代码示例

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


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

示例1: getOperatorPrecedence

/**
 * Returns the precedence of an infix operator. Operators
 * with higher precedence are executed before expressions
 * with lower precedence.
 * <br>
 * i.e. in: <br>
 * <code>3 + 4 - 5 * 6;</code><br>
 * the  precedence order is
 * <ul>
 * <li>*</li>
 * <li>+</li>
 * <li>-</li>
 * </ul>
 * 1. 5,6 -(*)-> 30<br>
 * 2. 3,4 -(+)-> 7<br>
 * 3. 7,30 -(-)-> -23<br>
 *
 * @param operator the expression to determine the precedence for
 * @return the precedence the higher to stronger the binding to its operands
 */
public static int getOperatorPrecedence(Operator operator) {
	if (operator == Operator.CONDITIONAL_OR) {
		return CONDITIONAL_OR;
	} else if (operator == Operator.CONDITIONAL_AND) {
		return CONDITIONAL_AND;
	} else if (operator == Operator.OR) {
		return BITWISE_INCLUSIVE_OR;
	} else if (operator == Operator.XOR) {
		return BITWISE_EXCLUSIVE_OR;
	} else if (operator == Operator.AND) {
		return BITWISE_AND;
	} else if (operator == Operator.EQUALS || operator == Operator.NOT_EQUALS) {
		return EQUALITY;
	} else if (operator == Operator.LESS || operator == Operator.LESS_EQUALS || operator == Operator.GREATER || operator == Operator.GREATER_EQUALS) {
		return RELATIONAL;
	} else if (operator == Operator.LEFT_SHIFT || operator == Operator.RIGHT_SHIFT_SIGNED || operator == Operator.RIGHT_SHIFT_UNSIGNED) {
		return SHIFT;
	} else if (operator == Operator.PLUS || operator == Operator.MINUS) {
		return ADDITIVE;
	} else if (operator == Operator.REMAINDER || operator == Operator.DIVIDE || operator == Operator.TIMES) {
		return MULTIPLICATIVE;
	}
	return Integer.MAX_VALUE;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:44,代码来源:OperatorPrecedence.java

示例2: getOperatorPrecedence

/**
 * Returns the precedence of an infix operator. Operators with higher precedence are executed
 * before expressions with lower precedence. <br>
 * i.e. in: <br>
 * <code>3 + 4 - 5 * 6;</code><br>
 * the precedence order is
 *
 * <ul>
 *   <li>*
 *   <li>+
 *   <li>-
 * </ul>
 *
 * 1. 5,6 -(*)-> 30<br>
 * 2. 3,4 -(+)-> 7<br>
 * 3. 7,30 -(-)-> -23<br>
 *
 * @param operator the expression to determine the precedence for
 * @return the precedence the higher to stronger the binding to its operands
 */
public static int getOperatorPrecedence(Operator operator) {
  if (operator == Operator.CONDITIONAL_OR) {
    return CONDITIONAL_OR;
  } else if (operator == Operator.CONDITIONAL_AND) {
    return CONDITIONAL_AND;
  } else if (operator == Operator.OR) {
    return BITWISE_INCLUSIVE_OR;
  } else if (operator == Operator.XOR) {
    return BITWISE_EXCLUSIVE_OR;
  } else if (operator == Operator.AND) {
    return BITWISE_AND;
  } else if (operator == Operator.EQUALS || operator == Operator.NOT_EQUALS) {
    return EQUALITY;
  } else if (operator == Operator.LESS
      || operator == Operator.LESS_EQUALS
      || operator == Operator.GREATER
      || operator == Operator.GREATER_EQUALS) {
    return RELATIONAL;
  } else if (operator == Operator.LEFT_SHIFT
      || operator == Operator.RIGHT_SHIFT_SIGNED
      || operator == Operator.RIGHT_SHIFT_UNSIGNED) {
    return SHIFT;
  } else if (operator == Operator.PLUS || operator == Operator.MINUS) {
    return ADDITIVE;
  } else if (operator == Operator.REMAINDER
      || operator == Operator.DIVIDE
      || operator == Operator.TIMES) {
    return MULTIPLICATIVE;
  }
  return Integer.MAX_VALUE;
}
 
开发者ID:eclipse,项目名称:che,代码行数:51,代码来源:OperatorPrecedence.java


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