private static void parseParam ( final String param , final List < String > metric_queries , final ExpressionTree root , final TSQuery data_query , final int index ) { if ( param == null || param . length ( ) == 0 ) { throw new IllegalArgumentException ( "Parameter cannot be null or empty" ) ; } if ( param . indexOf ( ' ' ) > 0 && param . indexOf ( ' ' ) > 0 ) { // sub expression final ExpressionTree sub_tree = parse ( param , metric_queries , data_query ) ; root . addSubExpression ( sub_tree , index ) ; } else if ( param . indexOf ( ' ' ) >= 0 ) { // metric query metric_queries . add ( param ) ; root . addSubMetricQuery ( param , metric_queries . size ( ) - 1 , index ) ; } else { // expression parameter root . addFunctionParameter ( param ) ; } }
Helper that parses out the parameter from the expression