Clover coverage report - PLT Utilities Test Coverage (plt-20120304-r5436)
Coverage timestamp: Sat Mar 3 2012 22:01:56 CST
file stats: LOC: 98   Methods: 31
NCLOC: 43   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DelegatingCollection.java - 29% 29% 29%
coverage coverage
 1    /*BEGIN_COPYRIGHT_BLOCK*
 2   
 3    PLT Utilities BSD License
 4   
 5    Copyright (c) 2007-2010 JavaPLT group at Rice University
 6    All rights reserved.
 7   
 8    Developed by: Java Programming Languages Team
 9    Rice University
 10    http://www.cs.rice.edu/~javaplt/
 11   
 12    Redistribution and use in source and binary forms, with or without modification, are permitted
 13    provided that the following conditions are met:
 14   
 15    - Redistributions of source code must retain the above copyright notice, this list of conditions
 16    and the following disclaimer.
 17    - Redistributions in binary form must reproduce the above copyright notice, this list of
 18    conditions and the following disclaimer in the documentation and/or other materials provided
 19    with the distribution.
 20    - Neither the name of the JavaPLT group, Rice University, nor the names of the library's
 21    contributors may be used to endorse or promote products derived from this software without
 22    specific prior written permission.
 23   
 24    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
 25    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 26    FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND
 27    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 28    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 29    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 30    IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 31    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 32   
 33    *END_COPYRIGHT_BLOCK*/
 34   
 35    package edu.rice.cs.plt.collect;
 36   
 37    import java.util.Iterator;
 38    import java.util.Collection;
 39    import java.util.AbstractCollection;
 40    import java.io.Serializable;
 41    import edu.rice.cs.plt.iter.SizedIterable;
 42    import edu.rice.cs.plt.iter.IterUtil;
 43    import edu.rice.cs.plt.object.Composite;
 44    import edu.rice.cs.plt.object.ObjectUtil;
 45   
 46    /**
 47    * A collection that delegates all operations to a wrapped collection. Subclasses can be defined
 48    * that override a few of the methods, while maintaining the default delegation behavior in most cases.
 49    * Since instances of this class must <em>not</em> be equal to some collections (such as {@code Set}s
 50    * and {@code List}s -- allowing the equivalence would violate symmetry), the {@code equals()} and
 51    * {@code hashCode()} methods are not implemented, and inherit the {@link Object} defaults.
 52    * Subclasses can also invoke the overridden methods in {@link AbstractCollection} to use the
 53    * default implementations there by invoking, for example, {@link #abstractCollectionAddAll}
 54    * (see {@link java.util.AbstractCollection} for details on the default implementations).
 55    */
 56    public class DelegatingCollection<T> extends AbstractCollection<T> implements SizedIterable<T>, Composite, Serializable {
 57   
 58    protected Collection<T> _delegate;
 59   
 60  203 public DelegatingCollection(Collection<T> delegate) { _delegate = delegate; }
 61   
 62  0 public int compositeHeight() { return ObjectUtil.compositeHeight(_delegate) + 1; }
 63  0 public int compositeSize() { return ObjectUtil.compositeSize(_delegate) + 1; }
 64   
 65  29 public boolean isEmpty() { return _delegate.isEmpty(); }
 66  45 public int size() { return _delegate.size(); }
 67  0 public int size(int bound) { return IterUtil.sizeOf(_delegate, bound); }
 68  0 public boolean isInfinite() { return IterUtil.isInfinite(_delegate); }
 69  0 public boolean hasFixedSize() { return IterUtil.hasFixedSize(_delegate); }
 70  0 public boolean isStatic() { return IterUtil.isStatic(_delegate); }
 71   
 72  64 public boolean contains(Object o) { return _delegate.contains(o); }
 73  4 public boolean containsAll(Collection<?> c) { return _delegate.containsAll(c); }
 74  0 public Iterator<T> iterator() { return _delegate.iterator(); }
 75  0 public Object[] toArray() { return _delegate.toArray(); }
 76  0 public <S> S[] toArray(S[] a) { return _delegate.toArray(a); }
 77   
 78  0 public boolean add(T o) { return _delegate.add(o); }
 79  0 public boolean addAll(Collection<? extends T> c) { return _delegate.addAll(c); }
 80  0 public boolean remove(Object o) { return _delegate.remove(o); }
 81  0 public boolean retainAll(Collection<?> c) { return _delegate.retainAll(c); }
 82  0 public boolean removeAll(Collection<?> c) { return _delegate.removeAll(c); }
 83  9 public void clear() { _delegate.clear(); }
 84   
 85  6 public String toString() { return _delegate.toString(); }
 86   
 87  0 protected boolean abstractCollectionIsEmpty() { return super.isEmpty(); }
 88  0 protected boolean abstractCollectionContains(Object o) { return super.contains(o); }
 89  0 protected Object[] abstractCollectionToArray() { return super.toArray(); }
 90  0 protected <S> S[] abstractCollectionToArray(S[] a) { return super.toArray(a); }
 91  0 protected boolean abstractCollectionRemove(T o) { return super.remove(o); }
 92  0 protected boolean abstractCollectionContainsAll(Collection<?> c) { return super.containsAll(c); }
 93  1 protected boolean abstractCollectionAddAll(Collection<? extends T> c) { return super.addAll(c); }
 94  0 protected boolean abstractCollectionRetainAll(Collection<?> c) { return super.retainAll(c); }
 95  2 protected boolean abstractCollectionRemoveAll(Collection<?> c) { return super.removeAll(c); }
 96  0 protected void abstractCollectionClear() { super.clear(); }
 97   
 98    }