Coverage Summary for Class: ForwardingBlockingDeque (com.google.common.collect)

Class Class, % Method, % Line, %
ForwardingBlockingDeque 0% (0/1) 0% (0/16) 0% (0/16)


1 /* 2  * Copyright (C) 2012 The Guava Authors 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  17 package com.google.common.collect; 18  19 import com.google.common.annotations.GwtIncompatible; 20 import java.util.Collection; 21 import java.util.concurrent.BlockingDeque; 22 import java.util.concurrent.TimeUnit; 23  24 /** 25  * A {@link BlockingDeque} which forwards all its method calls to another {@code BlockingDeque}. 26  * Subclasses should override one or more methods to modify the behavior of the backing deque as 27  * desired per the <a href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. 28  * 29  * <p><b>Warning:</b> The methods of {@code ForwardingBlockingDeque} forward <b>indiscriminately</b> 30  * to the methods of the delegate. For example, overriding {@link #add} alone <b>will not</b> change 31  * the behaviour of {@link #offer} which can lead to unexpected behaviour. In this case, you should 32  * override {@code offer} as well, either providing your own implementation, or delegating to the 33  * provided {@code standardOffer} method. 34  * 35  * <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code 36  * default} methods. Instead, it inherits their default implementations. When those implementations 37  * invoke methods, they invoke methods on the {@code ForwardingBlockingDeque}. 38  * 39  * <p>The {@code standard} methods are not guaranteed to be thread-safe, even when all of the 40  * methods that they depend on are thread-safe. 41  * 42  * @author Emily Soldal 43  * @since 14.0 44  * @deprecated This class has moved to {@code com.google.common.util.concurrent}. Please use {@link 45  * com.google.common.util.concurrent.ForwardingBlockingDeque} instead. 46  */ 47 @Deprecated 48 @GwtIncompatible 49 public abstract class ForwardingBlockingDeque<E> extends ForwardingDeque<E> 50  implements BlockingDeque<E> { 51  52  /** Constructor for use by subclasses. */ 53  protected ForwardingBlockingDeque() {} 54  55  @Override 56  protected abstract BlockingDeque<E> delegate(); 57  58  @Override 59  public int remainingCapacity() { 60  return delegate().remainingCapacity(); 61  } 62  63  @Override 64  public void putFirst(E e) throws InterruptedException { 65  delegate().putFirst(e); 66  } 67  68  @Override 69  public void putLast(E e) throws InterruptedException { 70  delegate().putLast(e); 71  } 72  73  @Override 74  public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException { 75  return delegate().offerFirst(e, timeout, unit); 76  } 77  78  @Override 79  public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException { 80  return delegate().offerLast(e, timeout, unit); 81  } 82  83  @Override 84  public E takeFirst() throws InterruptedException { 85  return delegate().takeFirst(); 86  } 87  88  @Override 89  public E takeLast() throws InterruptedException { 90  return delegate().takeLast(); 91  } 92  93  @Override 94  public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException { 95  return delegate().pollFirst(timeout, unit); 96  } 97  98  @Override 99  public E pollLast(long timeout, TimeUnit unit) throws InterruptedException { 100  return delegate().pollLast(timeout, unit); 101  } 102  103  @Override 104  public void put(E e) throws InterruptedException { 105  delegate().put(e); 106  } 107  108  @Override 109  public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { 110  return delegate().offer(e, timeout, unit); 111  } 112  113  @Override 114  public E take() throws InterruptedException { 115  return delegate().take(); 116  } 117  118  @Override 119  public E poll(long timeout, TimeUnit unit) throws InterruptedException { 120  return delegate().poll(timeout, unit); 121  } 122  123  @Override 124  public int drainTo(Collection<? super E> c) { 125  return delegate().drainTo(c); 126  } 127  128  @Override 129  public int drainTo(Collection<? super E> c, int maxElements) { 130  return delegate().drainTo(c, maxElements); 131  } 132 }