test_class.declarator: collector
test_class.original_string: BatchingCollector collector;
test_class.type: BatchingCollector
test_class.var_name: collector
test_class.file: cyclops-futurestream/src/test/java/com/oath/cyclops/react/collectors/lazy/BatchingCollectorTest.java
test_class.identifier: BatchingCollectorTest
test_case.body: @Test
  	public void testAcceptMock495() {
  		collector = new BatchingCollector(new MaxActive(500,5), LazyReact.sequentialBuilder().of(1)).withResults(new ArrayList<>());
  		FastFuture cf = Mockito.mock(FastFuture.class);
  		BDDMockito.given(cf.isDone()).willReturn(true);
  		for(int i=0;i<1000;i++){
  			collector.accept(cf);
  		}
  		Mockito.verify(cf, Mockito.times(501)).isDone();
  	}
test_case.class_method_signature: BatchingCollectorTest.testAcceptMock495()
test_case.full_signature: @Test public void testAcceptMock495()
test_case.identifier: testAcceptMock495
test_case.invocations: withResults of sequentialBuilder mock willReturn given isDone accept isDone verify times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAcceptMock495()
focal_class.declarator: results
focal_class.modifier: private final
focal_class.original_string: private final Collection<FastFuture<T>> results;
focal_class.type: Collection<FastFuture<T>>
focal_class.var_name: results
focal_class.declarator: active = new ArrayList<>()
focal_class.modifier: private final
focal_class.original_string: private final List<FastFuture<T>> active = new ArrayList<>();
focal_class.type: List<FastFuture<T>>
focal_class.var_name: active
focal_class.declarator: maxActive
focal_class.modifier: @Getter
    private final
focal_class.original_string: @Getter
    private final MaxActive maxActive;
focal_class.type: MaxActive
focal_class.var_name: maxActive
focal_class.declarator: blocking
focal_class.modifier: @Getter
    private final
focal_class.original_string: @Getter
    private final BlockingStream<T> blocking;
focal_class.type: BlockingStream<T>
focal_class.var_name: blocking
focal_class.file: cyclops-futurestream/src/main/java/com/oath/cyclops/react/collectors/lazy/BatchingCollector.java
focal_class.identifier: BatchingCollector
focal_class.interfaces: implements LazyResultConsumer<T>
focal_class.class_method_signature: BatchingCollector.BatchingCollector(final MaxActive maxActive, final BlockingStream<T> blocking)
focal_class.full_signature: public  BatchingCollector(final MaxActive maxActive, final BlockingStream<T> blocking)
focal_class.identifier: BatchingCollector
focal_class.modifiers: public
focal_class.parameters: (final MaxActive maxActive, final BlockingStream<T> blocking)
focal_class.signature:  BatchingCollector(final MaxActive maxActive, final BlockingStream<T> blocking)
focal_class.class_method_signature: BatchingCollector.accept(final FastFuture<T> t)
focal_class.full_signature: @Override public void accept(final FastFuture<T> t)
focal_class.identifier: accept
focal_class.modifiers: @Override public
focal_class.parameters: (final FastFuture<T> t)
focal_class.return: void
focal_class.signature: void accept(final FastFuture<T> t)
focal_class.class_method_signature: BatchingCollector.block(final Function<FastFuture<T>, T> safeJoin)
focal_class.full_signature: @Override public void block(final Function<FastFuture<T>, T> safeJoin)
focal_class.identifier: block
focal_class.modifiers: @Override public
focal_class.parameters: (final Function<FastFuture<T>, T> safeJoin)
focal_class.return: void
focal_class.signature: void block(final Function<FastFuture<T>, T> safeJoin)
focal_class.class_method_signature: BatchingCollector.getResults()
focal_class.full_signature: @Override public Collection<FastFuture<T>> getResults()
focal_class.identifier: getResults
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Collection<FastFuture<T>>
focal_class.signature: Collection<FastFuture<T>> getResults()
focal_class.class_method_signature: BatchingCollector.getAllResults()
focal_class.full_signature: @Override public Collection<FastFuture<T>> getAllResults()
focal_class.identifier: getAllResults
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Collection<FastFuture<T>>
focal_class.signature: Collection<FastFuture<T>> getAllResults()
focal_method.body: @Override
    public void accept(final FastFuture<T> t) {
  
      active.add(t);
  
      if (active.size() > maxActive.getMaxActive()) {
  
        while (active.size() > maxActive.getReduceTo()) {
  
          final List<FastFuture<T>> toRemove = active.stream()
            .filter(cf -> cf.isDone())
            .collect(Collectors.toList());
          active.removeAll(toRemove);
          results.addAll(toRemove);
          if (active.size() > maxActive.getReduceTo()) {
            final CompletableFuture promise = new CompletableFuture();
            FastFuture.xOf(active.size() - maxActive.getReduceTo(), () -> {
              promise.complete(true);
            } , active.toArray(new FastFuture[0]));
  
            promise.join();
          }
  
        }
      }
  
    }
focal_method.class_method_signature: BatchingCollector.accept(final FastFuture<T> t)
focal_method.full_signature: @Override public void accept(final FastFuture<T> t)
focal_method.identifier: accept
focal_method.invocations: add size getMaxActive size getReduceTo collect filter stream isDone toList removeAll addAll size getReduceTo xOf size getReduceTo complete toArray join
focal_method.modifiers: @Override public
focal_method.parameters: (final FastFuture<T> t)
focal_method.return: void
focal_method.signature: void accept(final FastFuture<T> t)