ActivePlanN(List<JoinObserver1<? extends Object>> observers, Consumer<? super Object[]> onNext, Action onCompleted) { this.onNext = onNext; this.onCompleted = onCompleted; this.observers = new ArrayList<JoinObserver1<? extends Object>>(observers); for (JoinObserver1<? extends Object> jo : this.observers) { addJoinObserver(jo); } }
@Override protected void match() throws Exception { Object[] notifications = new Object[this.observers.size()]; int j = 0; int completedCount = 0; for (JoinObserver1<? extends Object> jo : this.observers) { if (jo.queue().isEmpty()) { return; } Notification<? extends Object> n = jo.queue().peek(); if (n.isOnComplete()) { completedCount++; } notifications[j] = n.getValue(); j++; } if (completedCount == j) { onCompleted.run(); } else { dequeue(); onNext.accept(notifications); } }
ActivePlanN activePlan = new ActivePlanN(observers, new Consumer<Object[]>() { @Override public void accept(Object[]args) {
@Override protected void match() throws Exception { Object[] notifications = new Object[this.observers.size()]; int j = 0; int completedCount = 0; for (JoinObserver1<? extends Object> jo : this.observers) { if (jo.queue().isEmpty()) { return; } Notification<? extends Object> n = jo.queue().peek(); if (n.isOnComplete()) { completedCount++; } notifications[j] = n.getValue(); j++; } if (completedCount == j) { onCompleted.run(); } else { dequeue(); onNext.accept(notifications); } }
ActivePlanN activePlan = new ActivePlanN(observers, new Consumer<Object[]>() { @Override public void accept(Object[]args) {
ActivePlanN(List<JoinObserver1<? extends Object>> observers, Consumer<? super Object[]> onNext, Action onCompleted) { this.onNext = onNext; this.onCompleted = onCompleted; this.observers = new ArrayList<JoinObserver1<? extends Object>>(observers); for (JoinObserver1<? extends Object> jo : this.observers) { addJoinObserver(jo); } }