ExpressionParser { public List<String> getDependentFields() { if (dependentFields == null) { dependentFields = new ArrayList<String>(); for (String variable : scope.getNames()) { if (!variable.equals("pi") && !variable.equals("E") && !variable.equals("euler")) dependentFields.add(variable); } } return dependentFields; } ExpressionParser(String exprStr); @SuppressWarnings("unused")  ExpressionParser(String exprStr, Map<String, Double> context); @SuppressWarnings("unused") Scope getScope(); ExpressionParser setVariables(Map<String, Double> tuple); @SuppressWarnings("unused") ExpressionParser setVariable(Entry<String, Double> tuple); ExpressionParser setVariable(String key, Double value); double eval(); double eval(Map<String, Double> tuple); List<String> getDependentFields(); static ExpressionParser parse(String expr); static double eval(String expression,Map<String,Double> context); static double eval(String expression,TaggedLogAPIEntity entity);  }
@Test public void testgetDependency() throws Exception{ String exprStr = "min(mAx, Max) / abs(MAX)"; ExpressionParser parser = new ExpressionParser(exprStr); List<String> variables = parser.getDependentFields(); Assert.assertEquals(variables.size(), 3); Assert.assertTrue(variables.contains("mAx")); Assert.assertTrue(variables.contains("Max")); Assert.assertTrue(variables.contains("MAX")); }