// Path: src/main/java/com/plexobject/rx/Cancelable.java
// public interface Cancelable {
//     /**
//      * Cancel this operation
//      */
//     void cancel();
// 
//     /**
//      * Is operation canceled
//      * 
//      * @return
//      */
//     boolean isCanceled();
// }
// 
// Path: src/main/java/com/plexobject/rx/OnCompletion.java
// @FunctionalInterface
// public interface OnCompletion {
//     /**
//      * This method is called to notify user that all data is processed and there
//      * is no more data.
//      */
//     void onCompleted();
// }
// 
// Path: src/main/java/com/plexobject/rx/Streamable.java
// public interface Streamable<T> {
//     Stream<T> getStream();
// }
// 
// Path: src/main/java/com/plexobject/rx/scheduler/Scheduler.java
// public interface Scheduler extends Disposable {
//     /**
//      * This method registers user-defined function that is invoked by scheduler
//      * 
//      * @param consumer
//      *            - callback function to notify tick
//      * @param handle
//      *            to pass in with consumer
//      */
//     <T> void scheduleBackgroundTask(Consumer<T> consumer, T handle);
// 
//     public static Scheduler newThreadPoolScheduler(int poolSize) {
//         return new ThreadPoolScheduler(poolSize);
//     }
// 
//     public static Scheduler newImmediateScheduler() {
//         return new ImmediateScheduler();
//     }
// 
//     public static Scheduler newNewThreadScheduler() {
//         return new NewThreadScheduler();
//     }
// 
//     public static Scheduler newTimerSchedulerWithMilliInterval(long interval) {
//         return new TimerScheduler(interval);
//     }
// }


import java.util.Spliterator;
import java.util.concurrent.CountedCompleter;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import com.plexobject.rx.Cancelable;
import com.plexobject.rx.OnCompletion;
import com.plexobject.rx.Streamable;
import com.plexobject.rx.scheduler.Scheduler;
    }

    @Override
    public boolean tryAdvance(Consumer<? super T> action) {
        if (canceled.get()) {
            return false;
        }
        return delegate.tryAdvance(action);
    }

    @Override
    public Spliterator<T> trySplit() {
        return delegate.trySplit();
    }

    @Override
    public long estimateSize() {
        return delegate.estimateSize();
    }

    @Override
    public int characteristics() {
        return delegate.characteristics();
    }

    @Override
    public void cancel() {
        canceled.set(true);
    }

// Path: src/main/java/com/plexobject/rx/Cancelable.java
// public interface Cancelable {
//     /**
//      * Cancel this operation
//      */
//     void cancel();
// 
//     /**
//      * Is operation canceled
//      * 
//      * @return
//      */
//     boolean isCanceled();
// }
// 
// Path: src/main/java/com/plexobject/rx/OnCompletion.java
// @FunctionalInterface
// public interface OnCompletion {
//     /**
//      * This method is called to notify user that all data is processed and there
//      * is no more data.
//      */
//     void onCompleted();
// }
// 
// Path: src/main/java/com/plexobject/rx/Streamable.java
// public interface Streamable<T> {
//     Stream<T> getStream();
// }
// 
// Path: src/main/java/com/plexobject/rx/scheduler/Scheduler.java
// public interface Scheduler extends Disposable {
//     /**
//      * This method registers user-defined function that is invoked by scheduler
//      * 
//      * @param consumer
//      *            - callback function to notify tick
//      * @param handle
//      *            to pass in with consumer
//      */
//     <T> void scheduleBackgroundTask(Consumer<T> consumer, T handle);
// 
//     public static Scheduler newThreadPoolScheduler(int poolSize) {
//         return new ThreadPoolScheduler(poolSize);
//     }
// 
//     public static Scheduler newImmediateScheduler() {
//         return new ImmediateScheduler();
//     }
// 
//     public static Scheduler newNewThreadScheduler() {
//         return new NewThreadScheduler();
//     }
// 
//     public static Scheduler newTimerSchedulerWithMilliInterval(long interval) {
//         return new TimerScheduler(interval);
//     }
// }


// Path: src/main/java/com/plexobject/rx/util/CancelableSpliterator.java
import java.util.Spliterator;
import java.util.concurrent.CountedCompleter;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import com.plexobject.rx.Cancelable;
import com.plexobject.rx.OnCompletion;
import com.plexobject.rx.Streamable;
import com.plexobject.rx.scheduler.Scheduler;

    }

    @Override
    public boolean tryAdvance(Consumer<? super T> action) {
        if (canceled.get()) {
            return false;
        }
        return delegate.tryAdvance(action);
    }

    @Override
    public Spliterator<T> trySplit() {
        return delegate.trySplit();
    }

    @Override
    public long estimateSize() {
        return delegate.estimateSize();
    }

    @Override
    public int characteristics() {
        return delegate.characteristics();
    }

    @Override
    public void cancel() {
        canceled.set(true);
    }

    @Override