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


Java UnaryOperatorKind类代码示例

本文整理汇总了Java中org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind的典型用法代码示例。如果您正苦于以下问题:Java UnaryOperatorKind类的具体用法?Java UnaryOperatorKind怎么用?Java UnaryOperatorKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UnaryOperatorKind类属于org.apache.olingo.server.api.uri.queryoption.expression包,在下文中一共展示了UnaryOperatorKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public Object visitUnaryOperator(UnaryOperatorKind operator, Object operand)
		throws ExpressionVisitException, ODataApplicationException {
	String sparqlunary = "";
	switch (operator) {
	case MINUS:
		sparqlunary = "-";
		break;
	case NOT:
		sparqlunary = "!";
		break;
	default:
		throw new UnsupportedOperationException("Unsupported unary: " + operator.toString());
	}
	return sparqlunary;
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:17,代码来源:SparqlExpressionVisitor.java

示例2: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public VisitorOperand visitUnaryOperator(final UnaryOperatorKind operator, final VisitorOperand operand)
    throws ExpressionVisitException, ODataApplicationException {

  final UnaryOperator unaryOperator = new UnaryOperator(operand);

  switch (operator) {
  case MINUS:
    return unaryOperator.minusOperation();
  case NOT:
    return unaryOperator.notOperation();
  default:
    // Can't happen.
    return throwNotImplemented();
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:ExpressionVisitorImpl.java

示例3: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public Object visitUnaryOperator(UnaryOperatorKind operator, Object operand) 
    throws ExpressionVisitException, ODataApplicationException {
  // OData allows two different unary operators. We have to take care, that the type of the operand fits to
  // operand
  
  if(operator == UnaryOperatorKind.NOT && operand instanceof Boolean) {
    // 1.) boolean negation 
    return !(Boolean) operand;
  } else if(operator == UnaryOperatorKind.MINUS && operand instanceof Integer){
    // 2.) arithmetic minus
    return -(Integer) operand;
  }
  
  // Operation not processed, throw an exception
  throw new ODataApplicationException("Invalid type for unary operator", 
      HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:FilterExpressionVisitor.java

示例4: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
public Object visitUnaryOperator(UnaryOperatorKind operator, Object operand)
    throws ExpressionVisitException, ODataApplicationException {
  // OData allows two different unary operators. We have to take care, that the type of the operand fits to
  // operand
  
  if(operator == UnaryOperatorKind.NOT && operand instanceof Boolean) {
    // 1.) boolean negation 
    return !(Boolean) operand;
  } else if(operator == UnaryOperatorKind.MINUS && operand instanceof Integer){
    // 2.) arithmetic minus
    return -(Integer) operand;
  }
  
  // Operation not processed, throw an exception
  throw new ODataApplicationException("Invalid type for unary operator", 
      HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:FilterExpressionVisitor.java

示例5: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public Object visitUnaryOperator(
    UnaryOperatorKind operator,
    Object operand) throws ExpressionVisitException, ODataApplicationException {

  switch (operator) {
    case NOT:
      return not((QueryBuilder) operand);
    default:
      throw new NotImplementedException("Unary operator " + operator + " not implemented");
  }
}
 
开发者ID:pukkaone,项目名称:odata-spring-boot-starter,代码行数:13,代码来源:ElasticsearchExpressionVisitor.java

示例6: supportedOperators

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Test
public void supportedOperators() {
  assertEquals(UnaryOperatorKind.MINUS, UnaryOperatorKind.get("-"));
  assertEquals(null, UnaryOperatorKind.get("XXX"));

  assertEquals(BinaryOperatorKind.MOD, BinaryOperatorKind.get("mod"));
  assertEquals(null, BinaryOperatorKind.get("XXX"));

  assertEquals(MethodKind.CONCAT, MethodKind.get("concat"));
  assertEquals(null, MethodKind.get("XXX"));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:12,代码来源:ExpressionTest.java

示例7: unaryExpression

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Test
public void unaryExpression() throws Exception {
  Expression operand = new LiteralImpl("1.2", odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Decimal));
  UnaryImpl expression = new UnaryImpl(UnaryOperatorKind.MINUS, operand,
      odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Decimal));

  assertEquals(UnaryOperatorKind.MINUS, expression.getOperator());
  assertEquals(operand, expression.getOperand());
  assertEquals(odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Decimal), expression.getType());

  assertEquals("<- <1.2>>", expression.accept(new FilterTreeToText()));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:13,代码来源:ExpressionTest.java

示例8: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public JsonNode visitUnaryOperator(final UnaryOperatorKind operator, final JsonNode operand)
    throws ExpressionVisitException, ODataApplicationException {
  return nodeFactory.objectNode()
      .put(NODE_TYPE_NAME, UNARY_NAME)
      .put(OPERATOR_NAME, operator.toString())
      .put(TYPE_NAME, getType(operator))
      .set(OPERAND_NAME, operand);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:10,代码来源:ExpressionJsonVisitor.java

示例9: getType

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
private String getType(final UnaryOperatorKind operator) {
  switch (operator) {
  case MINUS:
    return NUMBER_NAME;
  case NOT:
    return BOOLEAN_NAME;
  }
  return UNKNOWN_NAME;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:10,代码来源:ExpressionJsonVisitor.java

示例10: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public VisitorOperand visitUnaryOperator(final UnaryOperatorKind operator, final VisitorOperand operand)
        throws ExpressionVisitException, ODataApplicationException {
    final UnaryOperator unaryOperator = new UnaryOperator(operand);
    switch (operator) {
        case MINUS:
            return unaryOperator.minusOperation();
        case NOT:
            return unaryOperator.notOperation();
        default:
            // Can't happen.
            return throwNotImplemented();
    }
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:15,代码来源:ExpressionVisitorImpl.java

示例11: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public SQLExpression visitUnaryOperator(UnaryOperatorKind operator, SQLExpression operand)
		throws ExpressionVisitException, ODataApplicationException {

	switch (operator) {
	case MINUS:	return new InverseExpression().setExpression(operand);
	case NOT: return new Parenthesis().setExpression(operand).setNot();

	default:
		break;
	}

	throw new ODataApplicationException(operator + " operator is not implemented", 
			HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}
 
开发者ID:jbaliuka,项目名称:sql-analytic,代码行数:16,代码来源:FilterExpressionVisitor.java

示例12: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public ExpressionMember visitUnaryOperator(UnaryOperatorKind operator, ExpressionMember operand)
        throws ExpressionVisitException, ODataApplicationException {
    return operator == UnaryOperatorKind.NOT ? operand.not()
            : throwNotImplemented("Unsupported unary operator");
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:7,代码来源:ElasticSearchExpressionVisitor.java

示例13: visitUnaryOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public String visitUnaryOperator(final UnaryOperatorKind operator, final String operand)
    throws ExpressionVisitException {

  return "<" + operator + " " + operand + ">";
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:7,代码来源:FilterTreeToText.java

示例14: UnaryImpl

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
public UnaryImpl(final UnaryOperatorKind operator, final Expression expression, final EdmType type) {
  this.operator = operator;
  this.expression = expression;
  this.type = type;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:6,代码来源:UnaryImpl.java

示例15: getOperator

import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; //导入依赖的package包/类
@Override
public UnaryOperatorKind getOperator() {
  return operator;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:5,代码来源:UnaryImpl.java


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