Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2011-2014 Pivotal Software, 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 reactor.rx;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import reactor.core.reactivestreams.SerializedSubscriber;
import reactor.fn.Consumer;
import reactor.rx.action.Action;
import reactor.rx.action.CompositeAction;
import reactor.rx.action.aggregation.WindowAction;
import reactor.rx.action.combination.DynamicMergeAction;
import reactor.rx.action.combination.FanInAction;
import reactor.rx.action.combination.FanInSubscription;
import reactor.rx.action.combination.SwitchAction;
import reactor.rx.action.error.RetryWhenAction;
import reactor.rx.action.transformation.GroupByAction;
import reactor.rx.stream.GroupedStream;
import reactor.rx.subscription.FanOutSubscription;
import reactor.rx.subscription.PushSubscription;
import java.io.Serializable;
import java.util.*;
/**
* A simple collection of utils to assist in various tasks such as Debugging
*
* @author Stephane Maldini
* @since 1.1
*/
public abstract class StreamUtils {
public static StreamVisitor browse(Stream composable) {
return browse(composable, new DebugVisitor());
}
public static StreamVisitor browse(Stream composable, DebugVisitor visitor) {
StreamVisitor explorer = new StreamVisitor(visitor);
explorer.accept(composable);
return explorer;
}
static class DebugVisitor implements Consumer> {
final private StringBuilder appender = new StringBuilder();
final private List errors = new ArrayList();
int d = 0;
@Override
public void accept(Stream> composable) {
newLine(d);
appender.append(composable.getClass().getSimpleName().isEmpty() ? composable.getClass().getName() + "" +
composable :
composable
.getClass()
.getSimpleName().replaceAll("Action", "") + "[" + composable + "]");
}
@Override
public String toString() {
return appender.toString();
}
public void newMulticastLine(int d) {
appender.append("\n");
for (int i = 0; i < d+1; i++)
appender.append("| ");
}
private void newLine(int d) {
newLine(d, true);
}
private void newLine(int d, boolean prefix) {
appender.append("\n");
for (int i = 0; i < d; i++)
appender.append("| ");
if (prefix) appender.append("|____");
}
}
public static class StreamVisitor implements Consumer> {
final private Set