if (generator != null)
clause.whereInRange(generator.getStart(),generator.getEnd()); // automatically also adds a generator to limit range
CalculatedValuesFunctor visitor = CalculatedValuesFunctor.getInstance(dataFunctor,values, (TimeIteratorGenerator)generator);
Query query = Query.getInstance();
query.selectFrom(clause);
if (generator != null && generator instanceof TimeIteratorGenerator) {
query.groupBy((TimeIteratorGenerator)generator)
.action(visitor);
} else {
clause.select(visitor); // replaces other one
}
query.execute();
}