// Path: library/src/main/java/com/google/android/material/motion/MotionObservable.java
// public class MotionObservable<T> extends IndefiniteObservable<MotionObserver<T>> {
// 
//   public MotionObservable(Connector<MotionObserver<T>> connector) {
//     super(connector);
//   }
// 
//   /**
//    * Subscribes to the IndefiniteObservable and ignores all incoming values.
//    *
//    * @see #subscribe(Observer)
//    */
//   public Subscription subscribe() {
//     return super.subscribe(new SimpleMotionObserver<T>() {
//       @Override
//       public void next(T value) {
//       }
//     });
//   }
// 
//   /**
//    * A light-weight operator builder. Applies the given operation to the incoming stream.
//    * <p>
//    * This is the preferred method for building new operators. This builder can be used to create
//    * any operator that only needs to modify or block values. All state events are forwarded
//    * along.
//    *
//    * @param operation An operation to apply to each incoming value. The operation must handle
//    * values of type {@link T} or more general types. For example, an operation that handles {@link
//    * View}s can be applied to a stream of {@link TextView}s.
//    * @param <U> The returned stream contains values of this type. The operation must output values
//    * of this type.
//    */
//   public <U> MotionObservable<U> compose(final Operation<T, U> operation) {
//     final MotionObservable<T> upstream = MotionObservable.this;
// 
//     return new MotionObservable<>(new Connector<MotionObserver<U>>() {
// 
//       @NonNull
//       @Override
//       public Disconnector connect(final MotionObserver<U> observer) {
//         operation.preConnect(observer);
//         final Subscription subscription = upstream.subscribe(new MotionObserver<T>() {
// 
//           @Override
//           public void next(T value) {
//             operation.next(observer, value);
//           }
// 
//           @Override
//           public void build(MotionBuilder<T> builder, T[] values) {
//             if (operation instanceof SameTypedMapOperation) {
//               //noinspection unchecked
//               ((SameTypedMapOperation<T>) operation).build(
//                 (MotionObserver<T>) observer, builder, values);
//             }
//           }
//         });
//         operation.postConnect(observer);
// 
//         return new Disconnector() {
// 
//           @Override
//           public void disconnect() {
//             operation.preDisconnect(observer);
//             subscription.unsubscribe();
//             operation.postDisconnect(observer);
//           }
//         };
//       }
//     });
//   }
// 
//   public <U> MotionObservable<U> compose(final RawOperation<T, U> operation) {
//     return operation.compose(this);
//   }
// }
// 
// Path: library/src/main/java/com/google/android/material/motion/MotionObserver.java
// public abstract class MotionObserver<T> extends Observer<T> {
// 
//   @Override
//   public abstract void next(T value);
// 
//   public abstract void build(MotionBuilder<T> builder, T... values);
// 
//   /**
//    * A simple observer for when you only want to implement {@link #next(Object)}.
//    */
//   public static abstract class SimpleMotionObserver<T> extends MotionObserver<T> {
//     @Override
//     public void build(MotionBuilder<T> builder, T[] values) {
//     }
//   }
// }
// 
// Path: library/src/main/java/com/google/android/material/motion/testing/TrackingMotionObserver.java
// public class TrackingMotionObserver<T> extends SimpleMotionObserver<T> {
// 
//   public final List<T> values = new ArrayList<>();
// 
//   @Override
//   public void next(T value) {
//     values.add(value);
//   }
// }
// 
// Path: library/src/main/java/com/google/android/material/motion/operators/IgnoreUntil.java
// public static <T> Operation<T, T> ignoreUntil(final T expected) {
//   return new FilterOperation<T>() {
// 
//     private boolean received;
// 
//     @Override
//     public boolean filter(T value) {
//       if (expected.equals(value)) {
//         received = true;
//       }
// 
//       return received;
//     }
//   };
// }


import static com.google.android.material.motion.operators.IgnoreUntil.ignoreUntil;
import static com.google.common.truth.Truth.assertThat;
import android.support.annotation.NonNull;
import com.google.android.indefinite.observable.IndefiniteObservable;
import com.google.android.material.motion.MotionObservable;
import com.google.android.material.motion.MotionObserver;
import com.google.android.material.motion.gestures.BuildConfig;
import com.google.android.material.motion.testing.TrackingMotionObserver;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import java.util.Arrays;
/*
 * Copyright 2016-present The Material Motion Authors. All Rights Reserved.
 *
 * 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 com.google.android.material.motion.operators;






@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class IgnoreUntilTests {
  @Test
  public void testIgnoreUntil() {
    TrackingMotionObserver<Float> tracker = new TrackingMotionObserver<>();
    float[] input = {20, 10, 60, 50, 10, 20, 80};
    floatSource(input)
      .compose(ignoreUntil(50f))
      .subscribe(tracker);

    assertThat(tracker.values).isEqualTo(Arrays.asList(50f, 10f, 20f, 80f));
  }

// Path: library/src/main/java/com/google/android/material/motion/MotionObservable.java
// public class MotionObservable<T> extends IndefiniteObservable<MotionObserver<T>> {
// 
//   public MotionObservable(Connector<MotionObserver<T>> connector) {
//     super(connector);
//   }
// 
//   /**
//    * Subscribes to the IndefiniteObservable and ignores all incoming values.
//    *
//    * @see #subscribe(Observer)
//    */
//   public Subscription subscribe() {
//     return super.subscribe(new SimpleMotionObserver<T>() {
//       @Override
//       public void next(T value) {
//       }
//     });
//   }
// 
//   /**
//    * A light-weight operator builder. Applies the given operation to the incoming stream.
//    * <p>
//    * This is the preferred method for building new operators. This builder can be used to create
//    * any operator that only needs to modify or block values. All state events are forwarded
//    * along.
//    *
//    * @param operation An operation to apply to each incoming value. The operation must handle
//    * values of type {@link T} or more general types. For example, an operation that handles {@link
//    * View}s can be applied to a stream of {@link TextView}s.
//    * @param <U> The returned stream contains values of this type. The operation must output values
//    * of this type.
//    */
//   public <U> MotionObservable<U> compose(final Operation<T, U> operation) {
//     final MotionObservable<T> upstream = MotionObservable.this;
// 
//     return new MotionObservable<>(new Connector<MotionObserver<U>>() {
// 
//       @NonNull
//       @Override
//       public Disconnector connect(final MotionObserver<U> observer) {
//         operation.preConnect(observer);
//         final Subscription subscription = upstream.subscribe(new MotionObserver<T>() {
// 
//           @Override
//           public void next(T value) {
//             operation.next(observer, value);
//           }
// 
//           @Override
//           public void build(MotionBuilder<T> builder, T[] values) {
//             if (operation instanceof SameTypedMapOperation) {
//               //noinspection unchecked
//               ((SameTypedMapOperation<T>) operation).build(
//                 (MotionObserver<T>) observer, builder, values);
//             }
//           }
//         });
//         operation.postConnect(observer);
// 
//         return new Disconnector() {
// 
//           @Override
//           public void disconnect() {
//             operation.preDisconnect(observer);
//             subscription.unsubscribe();
//             operation.postDisconnect(observer);
//           }
//         };
//       }
//     });
//   }
// 
//   public <U> MotionObservable<U> compose(final RawOperation<T, U> operation) {
//     return operation.compose(this);
//   }
// }
// 
// Path: library/src/main/java/com/google/android/material/motion/MotionObserver.java
// public abstract class MotionObserver<T> extends Observer<T> {
// 
//   @Override
//   public abstract void next(T value);
// 
//   public abstract void build(MotionBuilder<T> builder, T... values);
// 
//   /**
//    * A simple observer for when you only want to implement {@link #next(Object)}.
//    */
//   public static abstract class SimpleMotionObserver<T> extends MotionObserver<T> {
//     @Override
//     public void build(MotionBuilder<T> builder, T[] values) {
//     }
//   }
// }
// 
// Path: library/src/main/java/com/google/android/material/motion/testing/TrackingMotionObserver.java
// public class TrackingMotionObserver<T> extends SimpleMotionObserver<T> {
// 
//   public final List<T> values = new ArrayList<>();
// 
//   @Override
//   public void next(T value) {
//     values.add(value);
//   }
// }
// 
// Path: library/src/main/java/com/google/android/material/motion/operators/IgnoreUntil.java
// public static <T> Operation<T, T> ignoreUntil(final T expected) {
//   return new FilterOperation<T>() {
// 
//     private boolean received;
// 
//     @Override
//     public boolean filter(T value) {
//       if (expected.equals(value)) {
//         received = true;
//       }
// 
//       return received;
//     }
//   };
// }


// Path: library/src/test/java/com/google/android/material/motion/operators/IgnoreUntilTests.java
import static com.google.android.material.motion.operators.IgnoreUntil.ignoreUntil;
import static com.google.common.truth.Truth.assertThat;
import android.support.annotation.NonNull;
import com.google.android.indefinite.observable.IndefiniteObservable;
import com.google.android.material.motion.MotionObservable;
import com.google.android.material.motion.MotionObserver;
import com.google.android.material.motion.gestures.BuildConfig;
import com.google.android.material.motion.testing.TrackingMotionObserver;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import java.util.Arrays;

/*
 * Copyright 2016-present The Material Motion Authors. All Rights Reserved.
 *
 * 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 com.google.android.material.motion.operators;






@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class IgnoreUntilTests {
  @Test
  public void testIgnoreUntil() {
    TrackingMotionObserver<Float> tracker = new TrackingMotionObserver<>();
    float[] input = {20, 10, 60, 50, 10, 20, 80};
    floatSource(input)
      .compose(ignoreUntil(50f))
      .subscribe(tracker);

    assertThat(tracker.values).isEqualTo(Arrays.asList(50f, 10f, 20f, 80f));
  }

  @NonNull