// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static void assertState(boolean state, Supplier<String> message) {
//     if (!state) {
//         throw new DataLoaderAssertionException(message.get());
//     }
// }
// 
// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static <T> T nonNull(T t) {
//     return nonNull(t, () -> "nonNull object required");
// }


import org.dataloader.annotations.Internal;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static org.dataloader.impl.Assertions.assertState;
import static org.dataloader.impl.Assertions.nonNull;
        return isDone() && cause.get() == null;
    }

    @Override
    public boolean failed() {
        return isDone() && cause.get() != null;
    }

    @Override
    public boolean isDone() {
        return controller.toCompletableFuture().isDone();
    }

    @Override
    public Throwable cause() {
        return cause.get();
    }

    @Override
    public boolean succeeded(int index) {
        return CompletableFutureKit.succeeded(futures.get(index).toCompletableFuture());
    }

    @Override
    public Throwable cause(int index) {
        return CompletableFutureKit.cause(futures.get(index).toCompletableFuture());
    }

    @Override
    public T get(int index) {
// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static void assertState(boolean state, Supplier<String> message) {
//     if (!state) {
//         throw new DataLoaderAssertionException(message.get());
//     }
// }
// 
// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static <T> T nonNull(T t) {
//     return nonNull(t, () -> "nonNull object required");
// }


// Path: src/main/java/org/dataloader/impl/PromisedValuesImpl.java
import org.dataloader.annotations.Internal;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static org.dataloader.impl.Assertions.assertState;
import static org.dataloader.impl.Assertions.nonNull;

        return isDone() && cause.get() == null;
    }

    @Override
    public boolean failed() {
        return isDone() && cause.get() != null;
    }

    @Override
    public boolean isDone() {
        return controller.toCompletableFuture().isDone();
    }

    @Override
    public Throwable cause() {
        return cause.get();
    }

    @Override
    public boolean succeeded(int index) {
        return CompletableFutureKit.succeeded(futures.get(index).toCompletableFuture());
    }

    @Override
    public Throwable cause(int index) {
        return CompletableFutureKit.cause(futures.get(index).toCompletableFuture());
    }

    @Override
    public T get(int index) {
        assertState(isDone(), () -> "The PromisedValues MUST be complete before calling the get() method");