Java 类io.reactivex.functions.BooleanSupplier 实例源码

项目:Phoenix-for-VK    文件:CommentsInteractor.java   
@Override
public Single<List<Comment>> getAllCommentsRange(int accountId, Commented commented, int startFromCommentId, int continueToCommentId) {
    final TempData tempData = new TempData();

    BooleanSupplier booleanSupplier = () -> {
        for (VKApiComment c : tempData.comments) {
            if (continueToCommentId == c.id) {
                return true;
            }
        }

        return false;
    };

    Completable completable = startLooking(accountId, commented, tempData, startFromCommentId, continueToCommentId)
            .repeatUntil(booleanSupplier);

    return completable.toSingleDefault(tempData)
            .flatMap(data -> transform(accountId, commented, data.comments, data.profiles, data.groups));
}
项目:NotifyTools    文件:MainActivity.java   
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
  StatementFlowable.ifThen(new BooleanSupplier() {
    @Override public boolean getAsBoolean() throws Exception {
      return false;
    }
  },
      Flowable.just("An odd millisecond"),
      Flowable.just("An even millisecond")) ;
  return null;
}
项目:RxJava2Extensions    文件:NonoRepeatUntil.java   
RepeatUntilSubscriber(Subscriber<? super Void> actual,
        BooleanSupplier stop, Nono source) {
    this.actual = actual;
    this.stop = stop;
    this.source = source;
    this.s = new AtomicReference<Subscription>();
}
项目:RxJava2Extensions    文件:StatementObservableTest.java   
BooleanSupplier countdown(final int n) {
    return new BooleanSupplier() {
        int count = n;

        @Override
        public boolean getAsBoolean() {
            return count-- > 0;
        }
    };
}
项目:RxJava2Extensions    文件:StatementFlowableTest.java   
BooleanSupplier countdown(final int n) {
    return new BooleanSupplier() {
        int count = n;

        @Override
        public boolean getAsBoolean() {
            return count-- > 0;
        }
    };
}
项目:RxConditions    文件:FlowableIfThen.java   
FlowableIfThen(BooleanSupplier condition, Publisher<? extends T> then,
               Publisher<? extends T> orElse) {
    this.condition = condition;
    this.then = then;
    this.orElse = orElse;
}
项目:RxConditions    文件:MaybeIfThen.java   
MaybeIfThen(BooleanSupplier condition, MaybeSource<? extends T> then,
            MaybeSource<? extends T> orElse) {
    this.condition = condition;
    this.then = then;
    this.orElse = orElse;
}
项目:RxConditions    文件:SingleIfThen.java   
SingleIfThen(BooleanSupplier condition, SingleSource<? extends T> then,
             SingleSource<? extends T> orElse) {
    this.condition = condition;
    this.then = then;
    this.orElse = orElse;
}
项目:RxConditions    文件:CompletableIfThen.java   
CompletableIfThen(BooleanSupplier condition, CompletableSource then,
                  CompletableSource orElse) {
    this.condition = condition;
    this.then = then;
    this.orElse = orElse;
}
项目:RxConditions    文件:Statement.java   
public static <R> Observable<R> ifThen(BooleanSupplier condition, Observable<? extends R> then) {
    return ifThen(condition, then, Observable.<R> empty());
}
项目:RxConditions    文件:Statement.java   
public static <R> Observable<R> ifThen(BooleanSupplier condition, Observable<? extends R> then,
                                       Observable<? extends R> orElse) {
    return RxJavaPlugins.onAssembly(new ObservableIfThen<R>(condition, then, orElse));
}
项目:RxConditions    文件:Statement.java   
public static <R> Flowable<R> ifThen(BooleanSupplier condition, Publisher<? extends R> then,
                                     Flowable<? extends R> orElse) {

    return RxJavaPlugins.onAssembly(new FlowableIfThen<R>(condition, then, orElse));
}
项目:RxConditions    文件:Statement.java   
public static <R> Maybe<R> ifThen(BooleanSupplier condition, Maybe<? extends R> then,
                                  Maybe<? extends R> orElse) {

    return RxJavaPlugins.onAssembly(new MaybeIfThen<R>(condition, then, orElse));
}
项目:RxConditions    文件:Statement.java   
public static <R> Single<R> ifThen(BooleanSupplier condition, Single<? extends R> then,
                                   Single<? extends R> orElse) {

    return RxJavaPlugins.onAssembly(new SingleIfThen(condition, then, orElse));
}
项目:RxConditions    文件:Statement.java   
public static Completable ifThen(BooleanSupplier condition, Completable then,
                                 Completable orElse) {

    return RxJavaPlugins.onAssembly(new CompletableIfThen(condition, then, orElse));
}
项目:RxConditions    文件:ObservableIfThen.java   
ObservableIfThen(BooleanSupplier condition, ObservableSource<? extends T> then,
                 ObservableSource<? extends T> orElse) {
    this.condition = condition;
    this.then = then;
    this.orElse = orElse;
}
项目:RxJava2Extensions    文件:NonoRepeatUntil.java   
NonoRepeatUntil(Nono source, BooleanSupplier stop) {
    this.source = source;
    this.stop = stop;
}
项目:RxJava2Extensions    文件:FlowableIfThen.java   
FlowableIfThen(BooleanSupplier condition, Publisher<? extends T> then,
        Publisher<? extends T> orElse) {
    this.condition = condition;
    this.then = then;
    this.orElse = orElse;
}
项目:RxJava2Extensions    文件:FlowableWhileDoWhile.java   
FlowableWhileDoWhile(Publisher<? extends T> source, BooleanSupplier preCondition,
        BooleanSupplier postCondition) {
    this.source = source;
    this.preCondition = preCondition;
    this.postCondition = postCondition;
}
项目:RxJava2Extensions    文件:FlowableWhileDoWhile.java   
WhileDoWhileObserver(Subscriber<? super T> actual, BooleanSupplier postCondition, Publisher<? extends T> source) {
    this.actual = actual;
    this.wip = new AtomicInteger();
    this.postCondition = postCondition;
    this.source = source;
}
项目:RxJava2Extensions    文件:ObservableWhileDoWhile.java   
ObservableWhileDoWhile(ObservableSource<? extends T> source, BooleanSupplier preCondition,
        BooleanSupplier postCondition) {
    this.source = source;
    this.preCondition = preCondition;
    this.postCondition = postCondition;
}
项目:RxJava2Extensions    文件:ObservableWhileDoWhile.java   
WhileDoWhileObserver(Observer<? super T> actual, BooleanSupplier postCondition, ObservableSource<? extends T> source) {
    this.actual = actual;
    this.wip = new AtomicInteger();
    this.postCondition = postCondition;
    this.source = source;
}
项目:RxJava2Extensions    文件:ObservableIfThen.java   
ObservableIfThen(BooleanSupplier condition, ObservableSource<? extends T> then,
        ObservableSource<? extends T> orElse) {
    this.condition = condition;
    this.then = then;
    this.orElse = orElse;
}
项目:RxJava2Extensions    文件:StatementObservableTest.java   
@Before
public void before() {
    MockitoAnnotations.initMocks(this);
    scheduler = new TestScheduler();
    func = new Callable<Integer>() {
        int count = 1;

        @Override
        public Integer call() {
            return count++;
        }
    };
    funcError = new Callable<Integer>() {
        int count = 1;

        @Override
        public Integer call() {
            if (count == 2) {
                throw new RuntimeException("Forced failure!");
            }
            return count++;
        }
    };
    condition = new BooleanSupplier() {
        boolean r;

        @Override
        public boolean getAsBoolean() {
            r = !r;
            return r;
        }

    };
    conditionError = new BooleanSupplier() {
        boolean r;

        @Override
        public boolean getAsBoolean() {
            r = !r;
            if (!r) {
                throw new RuntimeException("Forced failure!");
            }
            return r;
        }

    };
}
项目:RxJava2Extensions    文件:StatementFlowableTest.java   
@Before
public void before() {
    MockitoAnnotations.initMocks(this);
    scheduler = new TestScheduler();
    func = new Callable<Integer>() {
        int count = 1;

        @Override
        public Integer call() {
            return count++;
        }
    };
    funcError = new Callable<Integer>() {
        int count = 1;

        @Override
        public Integer call() {
            if (count == 2) {
                throw new RuntimeException("Forced failure!");
            }
            return count++;
        }
    };
    condition = new BooleanSupplier() {
        boolean r;

        @Override
        public boolean getAsBoolean() {
            r = !r;
            return r;
        }

    };
    conditionError = new BooleanSupplier() {
        boolean r;

        @Override
        public boolean getAsBoolean() {
            r = !r;
            if (!r) {
                throw new RuntimeException("Forced failure!");
            }
            return r;
        }

    };
}
项目:cyclops    文件:SingleKind.java   
@BackpressureSupport(BackpressureKind.FULL)
@CheckReturnValue
@SchedulerSupport("none")
public Flowable<T> repeatUntil(BooleanSupplier stop) {
    return boxed.repeatUntil(stop);
}
项目:cyclops    文件:FlowableKind.java   
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport("none")
public Flowable<T> repeatUntil(BooleanSupplier stop) {
    return boxed.repeatUntil(stop);
}
项目:cyclops    文件:FlowableKind.java   
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport("none")
public Flowable<T> retryUntil(BooleanSupplier stop) {
    return boxed.retryUntil(stop);
}
项目:RxJava2Extensions    文件:StatementObservable.java   
/**
 * Return an Observable that emits the emissions from one specified
 * Observable if a condition evaluates to true, or from another specified
 * Observable otherwise.
 * <p>
 * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/ifThen.e.png" alt="">
 * 
 * @param <R>
 *            the result value type
 * @param condition
 *            the condition that decides which Observable to emit the
 *            emissions from
 * @param then
 *            the Observable sequence to emit to if {@code condition} is {@code true}
 * @param orElse
 *            the Observable sequence to emit to if {@code condition} is {@code false}
 * @return an Observable that mimics either the {@code then} or {@code orElse} Observables depending on a condition function
 */
public static <R> Observable<R> ifThen(BooleanSupplier condition, ObservableSource<? extends R> then,
        Observable<? extends R> orElse) {
    ObjectHelper.requireNonNull(condition, "condition is null");
    ObjectHelper.requireNonNull(then, "then is null");
    ObjectHelper.requireNonNull(orElse, "orElse is null");
    return RxJavaPlugins.onAssembly(new ObservableIfThen<R>(condition, then, orElse));
}
项目:RxJava2Extensions    文件:StatementFlowable.java   
/**
 * Return an Flowable that emits the emissions from one specified
 * Flowable if a condition evaluates to true, or from another specified
 * Flowable otherwise.
 * <p>
 * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/ifThen.e.png" alt="">
 * 
 * @param <R>
 *            the result value type
 * @param condition
 *            the condition that decides which Flowable to emit the
 *            emissions from
 * @param then
 *            the Flowable sequence to emit to if {@code condition} is {@code true}
 * @param orElse
 *            the Flowable sequence to emit to if {@code condition} is {@code false}
 * @return an Flowable that mimics either the {@code then} or {@code orElse} Observables depending on a condition function
 */
public static <R> Flowable<R> ifThen(BooleanSupplier condition, Publisher<? extends R> then,
        Flowable<? extends R> orElse) {
    ObjectHelper.requireNonNull(condition, "condition is null");
    ObjectHelper.requireNonNull(then, "then is null");
    ObjectHelper.requireNonNull(orElse, "orElse is null");
    return RxJavaPlugins.onAssembly(new FlowableIfThen<R>(condition, then, orElse));
}
项目:RxConditions    文件:Statement.java   
public static <R> Flowable<R> ifThen(BooleanSupplier condition, Publisher<? extends R> then) {

        return ifThen(condition, then, Flowable.<R>empty());
    }
项目:RxConditions    文件:Statement.java   
public static <R> Maybe<R> ifThen(BooleanSupplier condition, Maybe<? extends R> then) {

        return ifThen(condition, then, Maybe.<R>empty());
    }
项目:RxConditions    文件:Statement.java   
public static <R> Single<R> ifThen(BooleanSupplier condition, Single<? extends R> then) {

        return ifThen(condition, then, Single.<R>never());
    }
项目:RxConditions    文件:Statement.java   
public static Completable ifThen(BooleanSupplier condition, Completable then) {

        return ifThen(condition, then, Completable.complete());
    }
项目:RxJava2Extensions    文件:StatementObservable.java   
/**
 * Return an Observable that re-emits the emissions from the source
 * Observable, and then re-subscribes to the source long as a condition is
 * true.
 * <p>
 * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doWhile.png" alt="">
 * 
 * @param <T> the value type
 * @param source the source Observable to work with
 * @param postCondition
 *            the post condition to test after the source
 *            Observable completes
 * @return an Observable that replays the emissions from the source
 *         Observable, and then continues to replay them so long as the post
 *         condition is true
 */
public static <T> Observable<T> doWhile(ObservableSource<? extends T> source, BooleanSupplier postCondition) {
    ObjectHelper.requireNonNull(source, "source is null");
    ObjectHelper.requireNonNull(postCondition, "postCondition is null");
    return RxJavaPlugins.onAssembly(new ObservableWhileDoWhile<T>(source, AlwaysTrueBooleanSupplier.INSTANCE, postCondition));
}
项目:RxJava2Extensions    文件:StatementObservable.java   
/**
 * Return an Observable that re-emits the emissions from the source
 * Observable as long as the condition is true before the first or subsequent subscribe() calls.
 * <p>
 * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/whileDo.png" alt="">
 * 
 * @param <T> the value type
 * @param source the source Observable to work with
 * @param preCondition
 *            the condition to evaluate before subscribing to or
 *            replaying the source Observable
 * @return an Observable that replays the emissions from the source
 *         Observable so long as <code>preCondition</code> is true
 */
public static <T> Observable<T> whileDo(ObservableSource<? extends T> source, BooleanSupplier preCondition) {
    ObjectHelper.requireNonNull(source, "source is null");
    ObjectHelper.requireNonNull(preCondition, "preCondition is null");
    return RxJavaPlugins.onAssembly(new ObservableWhileDoWhile<T>(source, preCondition, preCondition));
}
项目:RxJava2Extensions    文件:StatementObservable.java   
/**
 * Return an Observable that emits the emissions from a specified Observable
 * if a condition evaluates to true, otherwise return an empty Observable.
 * <p>
 * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/ifThen.png" alt="">
 * 
 * @param <R>
 *            the result value type
 * @param condition
 *            the condition that decides whether to emit the emissions
 *            from the <code>then</code> Observable
 * @param then
 *            the Observable sequence to emit to if {@code condition} is {@code true}
 * @return an Observable that mimics the {@code then} Observable if the {@code condition} function evaluates to true, or an empty
 *         Observable otherwise
 */
public static <R> Observable<R> ifThen(BooleanSupplier condition, ObservableSource<? extends R> then) {
    return ifThen(condition, then, Observable.<R> empty());
}
项目:RxJava2Extensions    文件:StatementObservable.java   
/**
 * Return an Observable that emits the emissions from a specified Observable
 * if a condition evaluates to true, otherwise return an empty Observable
 * that runs on a specified Scheduler.
 * <p>
 * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/ifThen.s.png" alt="">
 * 
 * @param <R>
 *            the result value type
 * @param condition
 *            the condition that decides whether to emit the emissions
 *            from the <code>then</code> Observable
 * @param then
 *            the Observable sequence to emit to if {@code condition} is {@code true}
 * @param scheduler
 *            the Scheduler on which the empty Observable runs if the
 *            in case the condition returns false
 * @return an Observable that mimics the {@code then} Observable if the {@code condition} function evaluates to true, or an empty
 *         Observable running on the specified Scheduler otherwise
 */
public static <R> Observable<R> ifThen(BooleanSupplier condition, ObservableSource<? extends R> then, Scheduler scheduler) {
    return ifThen(condition, then, Observable.<R> empty().subscribeOn(scheduler));
}
项目:RxJava2Extensions    文件:StatementFlowable.java   
/**
 * Return an Flowable that re-emits the emissions from the source
 * Flowable, and then re-subscribes to the source long as a condition is
 * true.
 * <p>
 * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doWhile.png" alt="">
 * 
 * @param <T> the value type
 * @param source the source Flowable to work with
 * @param postCondition
 *            the post condition to test after the source
 *            Flowable completes
 * @return an Flowable that replays the emissions from the source
 *         Flowable, and then continues to replay them so long as the post
 *         condition is true
 */
public static <T> Flowable<T> doWhile(Publisher<? extends T> source, BooleanSupplier postCondition) {
    ObjectHelper.requireNonNull(source, "source is null");
    ObjectHelper.requireNonNull(postCondition, "postCondition is null");
    return RxJavaPlugins.onAssembly(new FlowableWhileDoWhile<T>(source, AlwaysTrueBooleanSupplier.INSTANCE, postCondition));
}
项目:RxJava2Extensions    文件:StatementFlowable.java   
/**
 * Return an Flowable that re-emits the emissions from the source
 * Flowable as long as the condition is true before the first or subsequent subscribe() calls.
 * <p>
 * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/whileDo.png" alt="">
 * 
 * @param <T> the value type
 * @param source the source Flowable to work with
 * @param preCondition
 *            the condition to evaluate before subscribing to or
 *            replaying the source Flowable
 * @return an Flowable that replays the emissions from the source
 *         Flowable so long as <code>preCondition</code> is true
 */
public static <T> Flowable<T> whileDo(Publisher<? extends T> source, BooleanSupplier preCondition) {
    ObjectHelper.requireNonNull(source, "source is null");
    ObjectHelper.requireNonNull(preCondition, "preCondition is null");
    return RxJavaPlugins.onAssembly(new FlowableWhileDoWhile<T>(source, preCondition, preCondition));
}