// Path: src/main/java/com/rc/gds/interfaces/GDSCallback.java
// public interface GDSCallback<T> {
// 	public void onSuccess(T t, Throwable err);
// }
// 
// Path: src/main/java/com/rc/gds/interfaces/GDSMultiResult.java
// public interface GDSMultiResult<T> {
// 	
// 	public void later(GDSResultReceiver<T> resultReceiver);
// 	
// 	public void laterAsList(GDSResultListReceiver<T> resultListReceiver);
// 	
// 	public List<T> asList();
// 	
// }
// 
// Path: src/main/java/com/rc/gds/interfaces/GDSResult.java
// public interface GDSResult<T> {
// 	
// 	public void later(GDSCallback<T> inCallback);
// 	
// 	public T now();
// 	
// }
// 
// Path: src/main/java/com/rc/gds/interfaces/GDSResultListReceiver.java
// public interface GDSResultListReceiver<T> {
// 	
// 	public void success(List<T> list, Throwable err);
// 
// }


import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import com.rc.gds.interfaces.GDSCallback;
import com.rc.gds.interfaces.GDSMultiResult;
import com.rc.gds.interfaces.GDSResult;
import com.rc.gds.interfaces.GDSResultListReceiver;

package com.rc.gds;



public class GDSBatcher {
	
	final GDSResult<?>[] singleResults;
	final GDSMultiResult<?>[] multiResults;
	
	public GDSBatcher(GDSResult<?>... input) {
		singleResults = input;
		multiResults = null;
	}
	
	public GDSBatcher(GDSMultiResult<?>... input) {
		singleResults = null;
		multiResults = input;
	}
	
	public GDSBatcher(GDSResult<?>[] singleResults, GDSMultiResult<?>[] multiResults) {
		this.singleResults = singleResults;
		this.multiResults = multiResults;
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public GDSResult<Boolean> onAllComplete() {
		final AtomicInteger current = new AtomicInteger(0);
		final AtomicInteger total = new AtomicInteger(0);
		final GDSAsyncImpl<Boolean> asyncResult = new GDSAsyncImpl<>();
		

// Path: src/main/java/com/rc/gds/interfaces/GDSCallback.java
// public interface GDSCallback<T> {
// 	public void onSuccess(T t, Throwable err);
// }
// 
// Path: src/main/java/com/rc/gds/interfaces/GDSMultiResult.java
// public interface GDSMultiResult<T> {
// 	
// 	public void later(GDSResultReceiver<T> resultReceiver);
// 	
// 	public void laterAsList(GDSResultListReceiver<T> resultListReceiver);
// 	
// 	public List<T> asList();
// 	
// }
// 
// Path: src/main/java/com/rc/gds/interfaces/GDSResult.java
// public interface GDSResult<T> {
// 	
// 	public void later(GDSCallback<T> inCallback);
// 	
// 	public T now();
// 	
// }
// 
// Path: src/main/java/com/rc/gds/interfaces/GDSResultListReceiver.java
// public interface GDSResultListReceiver<T> {
// 	
// 	public void success(List<T> list, Throwable err);
// 
// }


// Path: src/main/java/com/rc/gds/GDSBatcher.java
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import com.rc.gds.interfaces.GDSCallback;
import com.rc.gds.interfaces.GDSMultiResult;
import com.rc.gds.interfaces.GDSResult;
import com.rc.gds.interfaces.GDSResultListReceiver;

package com.rc.gds;



public class GDSBatcher {
	
	final GDSResult<?>[] singleResults;
	final GDSMultiResult<?>[] multiResults;
	
	public GDSBatcher(GDSResult<?>... input) {
		singleResults = input;
		multiResults = null;
	}
	
	public GDSBatcher(GDSMultiResult<?>... input) {
		singleResults = null;
		multiResults = input;
	}
	
	public GDSBatcher(GDSResult<?>[] singleResults, GDSMultiResult<?>[] multiResults) {
		this.singleResults = singleResults;
		this.multiResults = multiResults;
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public GDSResult<Boolean> onAllComplete() {
		final AtomicInteger current = new AtomicInteger(0);
		final AtomicInteger total = new AtomicInteger(0);
		final GDSAsyncImpl<Boolean> asyncResult = new GDSAsyncImpl<>();
		

		final GDSCallback singleCallback = new GDSCallback() {
