![JAR search and dependency download from the Maven repository](/logo.png)
rx.joins.operators.OperatorJoinPatterns Maven / Gradle / Ivy
The newest version!
/**
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package rx.joins.operators;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Observer;
import rx.Subscriber;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.joins.ActivePlan0;
import rx.joins.JoinObserver;
import rx.joins.Pattern1;
import rx.joins.Pattern2;
import rx.joins.Plan0;
import rx.subscriptions.CompositeSubscription;
/**
* Join patterns: And, Then, When.
*/
public final class OperatorJoinPatterns {
public OperatorJoinPatterns() { throw new IllegalStateException("No instances!"); }
/**
* Creates a pattern that matches when both observable sequences have an available element.
*/
public static Pattern2 and(/* this */Observable left, Observable right) {
if (left == null) {
throw new NullPointerException("left");
}
if (right == null) {
throw new NullPointerException("right");
}
return new Pattern2(left, right);
}
/**
* Matches when the observable sequence has an available element and projects the element by invoking the selector function.
*/
public static Plan0 then(/* this */Observable source, Func1 selector) {
if (source == null) {
throw new NullPointerException("source");
}
if (selector == null) {
throw new NullPointerException("selector");
}
return new Pattern1(source).then(selector);
}
/**
* Joins together the results from several patterns.
*/
public static OnSubscribe when(Plan0... plans) {
if (plans == null) {
throw new NullPointerException("plans");
}
return when(Arrays.asList(plans));
}
/**
* Joins together the results from several patterns.
*/
public static OnSubscribe when(final Iterable extends Plan0> plans) {
if (plans == null) {
throw new NullPointerException("plans");
}
return new OnSubscribe() {
@Override
public void call(final Subscriber super R> t1) {
final Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy