@Test @Ignore("Takes too long") public void test10MIterationsWithQuery() { final Map<String, String> attrs = new HashMap<>(); attrs.put("xx", "world"); final long start = System.nanoTime(); for (int i = 0; i < 10000000; i++) { assertEquals("world", Query.evaluateExpressions("${xx}", attrs)); } final long nanos = System.nanoTime() - start; System.out.println(TimeUnit.NANOSECONDS.toMillis(nanos)); }
@Override public String evaluateExpressions(final Map<String, String> valMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { final StringBuilder sb = new StringBuilder(); for (final String val : queryStrings) { final Tree tree = trees.get(val); if (tree == null) { sb.append(val); } else { final String evaluated = Query.evaluateExpression(tree, val, valMap, decorator, stateVariables); if (evaluated != null) { sb.append(evaluated); } } } return sb.toString(); }
StandardPreparedQuery implements PreparedQuery { @Override public String evaluateExpressions(final Map<String, String> valMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { final StringBuilder sb = new StringBuilder(); for (final String val : queryStrings) { final Tree tree = trees.get(val); if (tree == null) { sb.append(val); } else { final String evaluated = Query.evaluateExpression(tree, val, valMap, decorator, stateVariables); if (evaluated != null) { sb.append(evaluated); } } } return sb.toString(); } }
StandardPreparedQuery implements PreparedQuery { @Override public String evaluateExpressions(final Map<String, String> valMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { final StringBuilder sb = new StringBuilder(); for (final String val : queryStrings) { final Tree tree = trees.get(val); if (tree == null) { sb.append(val); } else { final String evaluated = Query.evaluateExpression(tree, val, valMap, decorator, stateVariables); if (evaluated != null) { sb.append(evaluated); } } } return sb.toString(); } StandardPreparedQuery(final List<String> queryStrings, final Map<String, Tree> trees); }
StandardPreparedQuery implements PreparedQuery { @Override public String evaluateExpressions(final Map<String, String> valMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { final StringBuilder sb = new StringBuilder(); for (final String val : queryStrings) { final Tree tree = trees.get(val); if (tree == null) { sb.append(val); } else { final String evaluated = Query.evaluateExpression(tree, val, valMap, decorator, stateVariables); if (evaluated != null) { sb.append(evaluated); } } } return sb.toString(); } StandardPreparedQuery(final List<String> queryStrings, final Map<String, Tree> trees); @Override String evaluateExpressions(final Map<String, String> valMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables); @Override String evaluateExpressions(final Map<String, String> valMap, final AttributeValueDecorator decorator); }
StandardPreparedQuery implements PreparedQuery { @Override public String evaluateExpressions(final Map<String, String> valMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { final StringBuilder sb = new StringBuilder(); for (final String val : queryStrings) { final Tree tree = trees.get(val); if (tree == null) { sb.append(val); } else { final String evaluated = Query.evaluateExpression(tree, val, valMap, decorator, stateVariables); if (evaluated != null) { sb.append(evaluated); } } } return sb.toString(); } StandardPreparedQuery(final List<String> queryStrings, final Map<String, Tree> trees); @Override String evaluateExpressions(final Map<String, String> valMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables); @Override String evaluateExpressions(final Map<String, String> valMap, final AttributeValueDecorator decorator);  }