Home | History | Annotate | Download | only in animation
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package android.animation;
     17 
     18 import com.google.common.util.concurrent.AbstractFuture;
     19 
     20 /**
     21  * Simple extension of {@link com.google.common.util.concurrent.AbstractFuture} which exposes a new
     22  * release() method which calls the protected
     23  * {@link com.google.common.util.concurrent.AbstractFuture#set(Object)} method internally. It
     24  * also exposes the protected {@link AbstractFuture#setException(Throwable)} method.
     25  */
     26 public class FutureWaiter extends AbstractFuture<Boolean> {
     27 
     28     /**
     29      * Release the Future currently waiting on
     30      * {@link com.google.common.util.concurrent.AbstractFuture#get()}.
     31      */
     32     public void release() {
     33         super.set(true);
     34     }
     35 
     36     /**
     37      * Used to indicate failure (when the result value is false).
     38      */
     39     public void set(boolean result) {
     40         super.set(result);
     41     }
     42 
     43     @Override
     44     public boolean setException(Throwable throwable) {
     45         return super.setException(throwable);
     46     }
     47 }
     48