Linq4jImplementor { public Enumerator<Void> implement() { Enumerable<T> datastream; if (predicate != null) { datastream = input.where(predicate::test); } else { datastream = input; } return implementEvaluation(datastream, groupAssigner, evaluations); } Linq4jImplementor(Root<T> root); Enumerator<Void> implement();  }
@Test public void implement2() throws NoSuchMethodException { final CrunchContext context = new CrunchContext(); final Root<UntypedValues> root = new Root<>(context, new AbstractEnumerable<UntypedValues>() { @Override public Enumerator<UntypedValues> enumerator() { return new Enumerator<UntypedValues>() { private Supplier<UntypedValues> source = getSignal(); private UntypedValues current = null; private long count = 0; @Override public UntypedValues current() { return current; } @Override public boolean moveNext() { this.current = source.get(); return count++ < 100; } @Override public void reset() { } @Override public void close() { } }; } }); final Filter<UntypedValues> filter = new Filter<>(i -> true); root.addChild(filter); final GroupBy<UntypedValues, String> groupBy = new GroupBy<>(u -> u.getSource()); filter.addChild(groupBy); final Evaluate<UntypedValues, Serializable> evaluate = new Evaluate<>(new SerializableEvaluationFunction()); groupBy.addChild(evaluate); final ResultHandler<Serializable> handler = new ResultHandler<>(null, Linq4jImplementorTest.class.getMethod("print", Object.class)); evaluate.addChild(handler); final Linq4jImplementor<UntypedValues, GenericEvent> implementor = new Linq4jImplementor<>(root); final Enumerator enumerator = implementor.implement(); while (enumerator.moveNext()) { enumerator.current(); } }