/** * Creates a new <tt>ProcessChain</tt> that uses this executor as the executor for all background tasks. * @return a new <tt>ProcessChain</tt> * * @see ProcessChain */ public ProcessChain<Void> createProcessChain() { return new ProcessChain<>(this); }
public ProcessChain<Void> addConsumerInPlatformThread(Consumer<T> consumer) { return addConsumer(consumer, ThreadType.PLATFORM); }
public <V> ProcessChain<V> addFunctionInExecutor(Function<T, V> function) { return addFunction(function, ThreadType.EXECUTOR); }
public Task<T> repeatInfinite() { return repeat(Integer.MAX_VALUE); }
public ProcessChain<Void> addRunnableInExecutor(Runnable runnable) { return addRunnable(runnable, ThreadType.EXECUTOR); }
public <V> ProcessChain<V> addSupplierInExecutor(Supplier<V> supplier) { return addSupplier(supplier, ThreadType.EXECUTOR); }
public Task<T> repeat(int count) { return repeat(count, Duration.ZERO); }
public ProcessChain<Void> addRunnableInPlatformThread(Runnable runnable) { return addRunnable(runnable, ThreadType.PLATFORM); }
public <V> ProcessChain<V> addSupplierInPlatformThread(Supplier<V> supplier) { return addSupplier(supplier, ThreadType.PLATFORM); }
public <V> ProcessChain<V> addFunctionInPlatformThread(Function<T, V> function) { return addFunction(function, ThreadType.PLATFORM); }
public static ProcessChain<Void> create() { return new ProcessChain<>(); }
public Task<T> repeatInfinite(Duration pauseTime) { return repeat(Integer.MAX_VALUE, pauseTime); }
public ProcessChain<Void> addConsumerInExecutor(Consumer<T> consumer) { return addConsumer(consumer, ThreadType.EXECUTOR); }
public ProcessChain<Void> addRunnable(Runnable runnable, ThreadType type) { return addFunction((Function<T, Void>) (e) -> { runnable.run(); return null; }, type); }
public static ProcessChain<Void> create(Executor executorService) { return new ProcessChain<>(executorService); }
public ProcessChain<Void> addConsumer(Consumer<T> consumer, ThreadType type) { return addFunction((Function<T, Void>) (e) -> { consumer.accept(e); return null; }, type); }
public <V> ProcessChain<V> addFunction(Function<T, V> function, ThreadType type) { processes.add(new ProcessDescription<T, V>(function, type)); return new ProcessChain<V>(executorService, processes); }
public <V> ProcessChain<V> addSupplier(Supplier<V> supplier, ThreadType type) { return addFunction((Function<T, V>) (e) -> { return supplier.get(); }, type); }