// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
// 
//     private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
// 
//     private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
// 
//     public static void register(Object object) {
//         TARGET_CENTER.register(object);
//     }
// 
//     public static boolean isRegistered(Object object) {
//         return TARGET_CENTER.isRegistered(object);
//     }
// 
//     public static void unregister(Object object) {
//         TARGET_CENTER.unregister(object);
//     }
// 
//     public static <T> Domino<T, T> createDomino(Object label) {
//         return new Domino<T, T>(label);
//     }
// 
//     public static <T> Domino<T, T> createAnonymousDomino() {
//         return createDomino(null);
//     }
// 
//     @SafeVarargs
//     public static <T> void playDomino(Object label, T... input) {
//         CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
//         if (input == null) {
//             newInput.add(null);
//         } else if (input.length > 0) {
//             newInput.addAll(Arrays.asList(input));
//         }
//         playDominoInternal(label, newInput);
//     }
// 
//     public static void playDomino(Object label) {
//         playDominoInternal(label, new CopyOnWriteArrayList<Object>());
//     }
// 
//     private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
//         DOMINO_CENTER.play(label, input);
//     }
// 
//     public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
//         return DOMINO_CENTER.getDomino(label);
//     }
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
//     void call();
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
//     void call(T input);
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
//     R call(T input);
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
//     void call(T t);
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
//     void call(T t, R input);
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
//     public final T1 first;
//     public final T2 second;
//     public final T3 third;
// 
//     @Deprecated
//     public Triple(T1 first, T2 second, T3 third) {
//         this.first = first;
//         this.second = second;
//         this.third = third;
//     }
// 
//     public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
//         return new Triple<T1, T2, T3>(first, second, third);
//     }
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
// 
// }


import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
                    public void call(S s, Triple<Boolean, Response<R>, Throwable> input) {
                        if (responseSuccess(input)) {
                            targetAction1.call(s, input.second.body());
                        }
                    }
                })
        );
    }

    public RetrofitDomino<T, R> onSuccessResult(final Domino<R, ?> domino) {
        return new RetrofitDomino<T, R>(
                perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
                        .reduce(new Function1<List<Triple<Boolean, Response<R>, Throwable>>, List<R>>() {
                            @Override
                            public List<R> call(List<Triple<Boolean, Response<R>, Throwable>> input) {
                                List<R> result= new ArrayList<R>();
                                for (Triple<Boolean, Response<R>, Throwable> triple : input) {
                                    if (responseSuccess(triple)) {
                                        result.add(triple.second.body());
                                    }
                                }
                                return result;
                            }
                        })
                        .flatMap(new ListIdentityOperator<R>())
                        .perform(domino)
                ));
    }

    private static <R> boolean responseFailure(Triple<Boolean, Response<R>, Throwable> triple) {
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
// 
//     private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
// 
//     private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
// 
//     public static void register(Object object) {
//         TARGET_CENTER.register(object);
//     }
// 
//     public static boolean isRegistered(Object object) {
//         return TARGET_CENTER.isRegistered(object);
//     }
// 
//     public static void unregister(Object object) {
//         TARGET_CENTER.unregister(object);
//     }
// 
//     public static <T> Domino<T, T> createDomino(Object label) {
//         return new Domino<T, T>(label);
//     }
// 
//     public static <T> Domino<T, T> createAnonymousDomino() {
//         return createDomino(null);
//     }
// 
//     @SafeVarargs
//     public static <T> void playDomino(Object label, T... input) {
//         CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
//         if (input == null) {
//             newInput.add(null);
//         } else if (input.length > 0) {
//             newInput.addAll(Arrays.asList(input));
//         }
//         playDominoInternal(label, newInput);
//     }
// 
//     public static void playDomino(Object label) {
//         playDominoInternal(label, new CopyOnWriteArrayList<Object>());
//     }
// 
//     private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
//         DOMINO_CENTER.play(label, input);
//     }
// 
//     public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
//         return DOMINO_CENTER.getDomino(label);
//     }
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
//     void call();
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
//     void call(T input);
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
//     R call(T input);
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
//     void call(T t);
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
//     void call(T t, R input);
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
//     public final T1 first;
//     public final T2 second;
//     public final T3 third;
// 
//     @Deprecated
//     public Triple(T1 first, T2 second, T3 third) {
//         this.first = first;
//         this.second = second;
//         this.third = third;
//     }
// 
//     public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
//         return new Triple<T1, T2, T3>(first, second, third);
//     }
// }
// 
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
// 
// }


// Path: shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;

                    public void call(S s, Triple<Boolean, Response<R>, Throwable> input) {
                        if (responseSuccess(input)) {
                            targetAction1.call(s, input.second.body());
                        }
                    }
                })
        );
    }

    public RetrofitDomino<T, R> onSuccessResult(final Domino<R, ?> domino) {
        return new RetrofitDomino<T, R>(
                perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
                        .reduce(new Function1<List<Triple<Boolean, Response<R>, Throwable>>, List<R>>() {
                            @Override
                            public List<R> call(List<Triple<Boolean, Response<R>, Throwable>> input) {
                                List<R> result= new ArrayList<R>();
                                for (Triple<Boolean, Response<R>, Throwable> triple : input) {
                                    if (responseSuccess(triple)) {
                                        result.add(triple.second.body());
                                    }
                                }
                                return result;
                            }
                        })
                        .flatMap(new ListIdentityOperator<R>())
                        .perform(domino)
                ));
    }

    private static <R> boolean responseFailure(Triple<Boolean, Response<R>, Throwable> triple) {
        return triple.first && (