use of com.ociweb.gl.impl.stage.ReactiveManagerPipeConsumer in project GreenLightning by oci-pronghorn.
the class MsgRuntime method autoWireTransducers.
protected Pipe<?>[] autoWireTransducers(final Behavior listener, Pipe<?>[] inputPipes, final ArrayList<ReactiveManagerPipeConsumer> consumers) {
if (inputPipes.length == 0) {
// no work since no inputs are used.
return inputPipes;
}
final Grouper g = new Grouper(inputPipes);
ChildClassScannerVisitor tVisitor = new ChildClassScannerVisitor() {
@Override
public boolean visit(Object child, Object topParent) {
if (g.additions() == 0) {
// add first value
Pipe[] pipes = builder.operators.createPipes(builder, listener, g);
consumers.add(new ReactiveManagerPipeConsumer(listener, builder.operators, pipes));
g.add(pipes);
}
int c = consumers.size();
while (--c >= 0) {
if (consumers.get(c).obj == child) {
// do not add this one it is already recorded
return true;
}
}
Pipe[] pipes = builder.operators.createPipes(builder, child, g);
consumers.add(new ReactiveManagerPipeConsumer(child, builder.operators, pipes));
g.add(pipes);
return true;
}
};
ChildClassScanner.visitUsedByClass(listener, tVisitor, ListenerTransducer.class);
if (g.additions() > 0) {
inputPipes = g.firstArray();
g.buildReplicators(gm, consumers);
}
return inputPipes;
}
Aggregations