/** * Recursive methods to create a {@link Function} starting from a {@link BinaryExpression} We * consider all possible values of the left and right expressions * * @param pred * @param lookupTable * @return */ private Function getFunction(BinaryExpression pred, LookupTable lookupTable) { Expression left = pred.getLeftExpression(); Expression right = pred.getRightExpression(); // left term can be function or column variable Term t1 = null; t1 = getFunction(left, lookupTable); if (t1 == null) { t1 = getVariable(left, lookupTable); } if (t1 == null) throw new RuntimeException("Unable to find column name for variable: " + left); // right term can be function, column variable or data value Term t2 = null; t2 = getFunction(right, lookupTable); if (t2 == null) { t2 = getVariable(right, lookupTable); } if (t2 == null) { t2 = getValueConstant(right, lookupTable); } // get boolean operation String op = pred.getStringExpression(); Function funct = null; if (op.equals("=")) funct = dfac.getFunctionEQ(t1, t2); else if (op.equals(">")) funct = dfac.getFunctionGT(t1, t2); else if (op.equals("<")) funct = dfac.getFunctionLT(t1, t2); else if (op.equals(">=")) funct = dfac.getFunctionGTE(t1, t2); else if (op.equals("<=")) funct = dfac.getFunctionLTE(t1, t2); else if (op.equals("<>")) funct = dfac.getFunctionNEQ(t1, t2); else if (op.equals("AND")) funct = dfac.getFunctionAND(t1, t2); else if (op.equals("OR")) funct = dfac.getFunctionOR(t1, t2); else if (op.equals("+")) funct = dfac.getFunctionAdd(t1, t2); else if (op.equals("-")) funct = dfac.getFunctionSubstract(t1, t2); else if (op.equals("*")) funct = dfac.getFunctionMultiply(t1, t2); else if (op.equals("LIKE")) funct = dfac.getFunctionLike(t1, t2); else throw new RuntimeException("Unknown opertor: " + op); return funct; }