public void aggregate(FlowProcess flow_process, AggregatorCall<Object> ag_call) { try { ISeq fn_args_seq = Util.coerceFromTuple(ag_call.getArguments().getTuple()); Object o; if (this.args > 0) o = this.init_fn.applyTo(fn_args_seq); else o = this.init_fn.invoke(); ISeq oseq = Util.coerceToSeq(o); ISeq currContext = (ISeq) ag_call.getContext(); if (currContext == null) { ag_call.setContext(oseq); } else { ag_call.setContext(Util.coerceToSeq(this.combine_fn.applyTo(Util.cat(currContext, oseq)))); } } catch (Exception e) { throw new RuntimeException(e); } }
@SuppressWarnings("unchecked") public void start(FlowProcess flowProcess, AggregatorCall<Tuple[]> aggregatorCall) { if (aggregatorCall.getContext() == null) aggregatorCall.setContext(new Tuple[1]); else aggregatorCall.getContext()[0] = null; }
public void start(FlowProcess flow_process, AggregatorCall<Object> ag_call) { ag_call.setContext(null); }