Package com.meidusa.amoeba.parser.expression

Examples of com.meidusa.amoeba.parser.expression.ColumnExpression


                parseExpr(exp, null);
            }

        } else if (expr instanceof ColumnExpression) {

            ColumnExpression columnExpr = (ColumnExpression) expr;

            column = columnExpr.getColumn();

            parseExpr(columnExpr.getExpression(), column);

        } else if (expr instanceof ComparisonExpression) {

            ComparisonExpression compExpr = (ComparisonExpression) expr;
View Full Code Here


    protected static void evaluateExpression(Expression expression, Map<Table, Map<Column, Comparative>> tablesMap,
                                             Object[] parameters) {
        if (expression instanceof BaseExpressionList) {
            evaluateExpression((BaseExpressionList) expression, tablesMap, parameters);
        } else if (expression instanceof ColumnExpression) {
            ColumnExpression colExpression = (ColumnExpression) expression;
            Table table = colExpression.getColumn().getTable();
            Map<Column, Comparative> columnMap = tablesMap.get(table);
            if (columnMap == null) {
                columnMap = new HashMap<Column, Comparative>();
                tablesMap.put(table, columnMap);
            }
            columnMap.put(colExpression.getColumn(), (Comparative) colExpression.evaluate(parameters));
        }
       
       
    }
View Full Code Here

        List<Expression> blist = elist.getAllExpression();
        for (Expression e : blist) {
            if (e instanceof BaseExpressionList) {
                evaluateExpression((BaseExpressionList) e, tablesMap, parameters);
            } else if (e instanceof ColumnExpression) {
                ColumnExpression colExpression = (ColumnExpression) e;
                Table table = colExpression.getColumn().getTable();
                Map<Column, Comparative> columnMap = tablesMap.get(table);
                if (columnMap == null) {
                    columnMap = new HashMap<Column, Comparative>();
                    tablesMap.put(table, columnMap);
                }
                Comparative col = columnMap.get(colExpression.getColumn());
                Comparative newComparative = (Comparative) colExpression.evaluate(parameters);
                if (col != null) {
                  if(col instanceof ComparativeBaseList){
                    ComparativeBaseList source = (ComparativeBaseList)col;
                    if((source instanceof ComparativeAND && and) || (source instanceof ComparativeOR && !and)){
                      source.addComparative(newComparative);
                    }else{
                      ComparativeBaseList comparativeBaseList = null;
                          if (and) {
                              comparativeBaseList = new ComparativeAND(col);
                          } else {
                              comparativeBaseList = new ComparativeOR(col);
                          }
                          comparativeBaseList.addComparative(newComparative);
                          columnMap.put(colExpression.getColumn(), comparativeBaseList);
                    }
                  }else{
                      ComparativeBaseList comparativeBaseList = null;
                      if (and) {
                          comparativeBaseList = new ComparativeAND(col);
                      } else {
                          comparativeBaseList = new ComparativeOR(col);
                      }
                      comparativeBaseList.addComparative(newComparative);
                      columnMap.put(colExpression.getColumn(), comparativeBaseList);
                  }
                } else {
                    columnMap.put(colExpression.getColumn(), newComparative);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.meidusa.amoeba.parser.expression.ColumnExpression

Copyright © 2018 www.massapicom. 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.