private static String guessParameterType ( Database db , VoltXMLElement elm ) { if ( ! isParameterized ( elm ) || ! elm . name . equals ( "operation" ) ) { return "" ; } else { final ExpressionType op = mapOfVoltXMLOpType . get ( elm . attributes . get ( "optype" ) ) ; assert op != null ; switch ( op ) { case CONJUNCTION_OR : case CONJUNCTION_AND : case OPERATOR_NOT : return "boolean" ; case COMPARE_GREATERTHAN : // For these 2 operator-ops, the type is what the non-parameterized part gets set to. case COMPARE_LESSTHAN : case COMPARE_EQUAL : case COMPARE_NOTEQUAL : case COMPARE_GREATERTHANOREQUALTO : case COMPARE_LESSTHANOREQUALTO : case OPERATOR_PLUS : case OPERATOR_MINUS : case OPERATOR_MULTIPLY : case OPERATOR_DIVIDE : case OPERATOR_CONCAT : case OPERATOR_MOD : case COMPARE_IN : final VoltXMLElement left = elm . children . get ( 0 ) , right = elm . children . get ( 1 ) ; return isParameterized ( left ) ? getType ( db , right ) : getType ( db , left ) ; case OPERATOR_UNARY_MINUS : return "integer" ; case OPERATOR_IS_NULL : case OPERATOR_EXISTS : return "" ; default : assert false ; return "" ; } } }
Guess from a parent node what are the parameter type of its child node should one of its child node contain parameter .