Examples of BinaryExpression


Examples of net.sf.jsqlparser.expression.BinaryExpression

        jj_la1[103] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      rightExpression = MultiplicativeExpression();
                        BinaryExpression binExp = (BinaryExpression) result;
                        binExp.setLeftExpression(leftExpression);
                        binExp.setRightExpression(rightExpression);
                        leftExpression = result;
    }
      {if (true) return result;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

Examples of net.sf.jsqlparser.expression.BinaryExpression

          jj_la1[106] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
                        BinaryExpression binExp = (BinaryExpression) result;
                        binExp.setLeftExpression(leftExpression);
                        binExp.setRightExpression(rightExpression);
                        leftExpression = result;
    }
      {if (true) return result;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

Examples of net.sf.jsqlparser.expression.BinaryExpression

    }
    if(ex instanceof OrExpression||ex instanceof AndExpression){
      parent.put("subQuery", "1");
      parent.put("filter", (ex instanceof OrExpression)?"OR":"AND");
     
      BinaryExpression be = (BinaryExpression)ex;
      generateList(be.getLeftExpression(), linkList,parent);
      generateList(be.getRightExpression(), linkList,parent);
 
    }else if(ex instanceof Parenthesis){
      JSONArray sublist = new JSONArray();//{colname:{operate:1,value:xxxx}}
      JSONObject subQuery=new JSONObject();
      subQuery.put("subQuery", "1");
View Full Code Here

Examples of net.sf.jsqlparser.expression.BinaryExpression

    }else{
      Column column = (Column)invokeMethod(e, "getLeftExpression");   
      oe.setColumnname(column.getColumnName());
    }
    if (e instanceof BinaryExpression) {
      BinaryExpression be = (BinaryExpression) e;
      oe.setExp(be.getStringExpression());
      if(be.getRightExpression() instanceof Function){
        oe.setValue(invokeMethod(be.getRightExpression(), "toString"));
      }else{
        oe.setValue(invokeMethod(be.getRightExpression(), "getValue"));
      }
    }else{
      oe.setExp((String)invokeMethod(e, "toString"));
    }
   
View Full Code Here

Examples of org.apache.camel.language.simple.ast.BinaryExpression

        // okay we are not inside a function or quote, so we want to support operators
        // and the special null value as well
        if (token.getType().isUnary()) {
            return new UnaryExpression(token);
        } else if (token.getType().isBinary()) {
            return new BinaryExpression(token);
        } else if (token.getType().isLogical()) {
            return new LogicalExpression(token);
        } else if (token.getType().isNullValue()) {
            return new NullExpression(token);
        }
View Full Code Here

Examples of org.apache.camel.language.simple.ast.BinaryExpression

            }
            SimpleNode token = nodes.get(i);
            SimpleNode right = i < nodes.size() - 1 ? nodes.get(i + 1) : null;

            if (token instanceof BinaryExpression) {
                BinaryExpression binary = (BinaryExpression) token;

                // remember the binary operator
                String operator = binary.getOperator().toString();

                if (left == null) {
                    throw new SimpleParserException("Binary operator " + operator + " has no left hand side token", token.getToken().getIndex());
                }
                if (!binary.acceptLeftNode(left)) {
                    throw new SimpleParserException("Binary operator " + operator + " does not support left hand side token " + left.getToken(), token.getToken().getIndex());
                }
                if (right == null) {
                    throw new SimpleParserException("Binary operator " + operator + " has no right hand side token", token.getToken().getIndex());
                }
                if (!binary.acceptRightNode(right)) {
                    throw new SimpleParserException("Binary operator " + operator + " does not support right hand side token " + right.getToken(), token.getToken().getIndex());
                }

                // pop previous as we need to replace it with this binary operator
                stack.pop();
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.expression.BinaryExpression

      default:
        throw new ODataNotImplementedException();
      }

    case BINARY:
      final BinaryExpression binaryExpression = (BinaryExpression) expression;
      final EdmSimpleType type = (EdmSimpleType) binaryExpression.getLeftOperand().getEdmType();
      final String left = evaluateExpression(data, binaryExpression.getLeftOperand());
      final String right = evaluateExpression(data, binaryExpression.getRightOperand());

      switch (binaryExpression.getOperator()) {
      case ADD:
        if (binaryExpression.getEdmType() == EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Double.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance()) {
          return Double.toString(Double.valueOf(left) + Double.valueOf(right));
        } else {
          return Long.toString(Long.valueOf(left) + Long.valueOf(right));
        }
      case SUB:
        if (binaryExpression.getEdmType() == EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Double.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance()) {
          return Double.toString(Double.valueOf(left) - Double.valueOf(right));
        } else {
          return Long.toString(Long.valueOf(left) - Long.valueOf(right));
        }
      case MUL:
        if (binaryExpression.getEdmType() == EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Double.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance()) {
          return Double.toString(Double.valueOf(left) * Double.valueOf(right));
        } else {
          return Long.toString(Long.valueOf(left) * Long.valueOf(right));
        }
      case DIV:
        final String number = Double.toString(Double.valueOf(left) / Double.valueOf(right));
        return number.endsWith(".0") ? number.replace(".0", "") : number;
      case MODULO:
        if (binaryExpression.getEdmType() == EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Double.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance()) {
          return Double.toString(Double.valueOf(left) % Double.valueOf(right));
        } else {
          return Long.toString(Long.valueOf(left) % Long.valueOf(right));
        }
      case AND:
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.expression.BinaryExpression

      default:
        throw new ODataNotImplementedException();
      }

    case BINARY:
      final BinaryExpression binaryExpression = (BinaryExpression) expression;
      final EdmSimpleType type = (EdmSimpleType) binaryExpression.getLeftOperand().getEdmType();
      final String left = evaluateExpression(data, binaryExpression.getLeftOperand());
      final String right = evaluateExpression(data, binaryExpression.getRightOperand());

      switch (binaryExpression.getOperator()) {
      case ADD:
        if (binaryExpression.getEdmType() == EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Double.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance()) {
          return Double.toString(Double.valueOf(left) + Double.valueOf(right));
        } else {
          return Long.toString(Long.valueOf(left) + Long.valueOf(right));
        }
      case SUB:
        if (binaryExpression.getEdmType() == EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Double.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance()) {
          return Double.toString(Double.valueOf(left) - Double.valueOf(right));
        } else {
          return Long.toString(Long.valueOf(left) - Long.valueOf(right));
        }
      case MUL:
        if (binaryExpression.getEdmType() == EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Double.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance()) {
          return Double.toString(Double.valueOf(left) * Double.valueOf(right));
        } else {
          return Long.toString(Long.valueOf(left) * Long.valueOf(right));
        }
      case DIV:
        final String number = Double.toString(Double.valueOf(left) / Double.valueOf(right));
        return number.endsWith(".0") ? number.replace(".0", "") : number;
      case MODULO:
        if (binaryExpression.getEdmType() == EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Double.getEdmSimpleTypeInstance()
            || binaryExpression.getEdmType() == EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance()) {
          return Double.toString(Double.valueOf(left) % Double.valueOf(right));
        } else {
          return Long.toString(Long.valueOf(left) % Long.valueOf(right));
        }
      case AND:
View Full Code Here

Examples of org.apache.pig.Expression.BinaryExpression

            return null;
        Expression cond =  pColConditions.get(0);
        for(int i=1; i<pColConditions.size(); i++){
            //if there is more than one condition expression
            // connect them using "AND"s
            cond = new BinaryExpression(cond, pColConditions.get(i),
                    OpType.OP_AND);
        }
        return cond;
    }
View Full Code Here

Examples of org.apache.pig.Expression.BinaryExpression

        return null;
    }
   
    private static Expression getExpression(BinaryExpressionOperator binOp, OpType
            opType) throws FrontendException {
        return new BinaryExpression(getExpression(binOp.getLhsOperand())
                ,getExpression(binOp.getRhsOperand()), opType);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.