Coverage Report - org.dishevelled.graph.impl.AbstractCollectionDecorator
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractCollectionDecorator
0%
0/22
0%
0/2
1.118
 
 1  
 /*
 2  
 
 3  
     dsh-graph  Directed graph interface and implementation.
 4  
     Copyright (c) 2004-2013 held jointly by the individual authors.
 5  
 
 6  
     This library is free software; you can redistribute it and/or modify it
 7  
     under the terms of the GNU Lesser General Public License as published
 8  
     by the Free Software Foundation; either version 3 of the License, or (at
 9  
     your option) any later version.
 10  
 
 11  
     This library is distributed in the hope that it will be useful, but WITHOUT
 12  
     ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
 13  
     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 14  
     License for more details.
 15  
 
 16  
     You should have received a copy of the GNU Lesser General Public License
 17  
     along with this library;  if not, write to the Free Software Foundation,
 18  
     Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
 19  
 
 20  
     > http://www.fsf.org/licensing/licenses/lgpl.html
 21  
     > http://www.opensource.org/licenses/lgpl-license.php
 22  
 
 23  
 */
 24  
 package org.dishevelled.graph.impl;
 25  
 
 26  
 import java.util.Collection;
 27  
 import java.util.Iterator;
 28  
 
 29  
 /**
 30  
  * Abstract collection that decorates an instance of <code>Collection</code>.
 31  
  *
 32  
  * @param <E> collection element type
 33  
  * @author  Michael Heuer
 34  
  * @version $Revision$ $Date$
 35  
  */
 36  
 abstract class AbstractCollectionDecorator<E>
 37  
     implements Collection<E>
 38  
 {
 39  
     /** Collection this decorator decorates. */
 40  
     private final Collection<E> collection;
 41  
 
 42  
 
 43  
     /**
 44  
      * Create a new abstract collection that
 45  
      * decorates the specified collection.
 46  
      *
 47  
      * @param collection collection to decorate, must not be null
 48  
      */
 49  
     protected AbstractCollectionDecorator(final Collection<E> collection)
 50  0
     {
 51  0
         if (collection == null)
 52  
         {
 53  0
             throw new IllegalArgumentException("collection must not be null");
 54  
         }
 55  0
         this.collection = collection;
 56  0
     }
 57  
 
 58  
 
 59  
     /**
 60  
      * Return a reference to the collection this decorator decorates.
 61  
      *
 62  
      * @return a reference to the collection this decorator decorates
 63  
      */
 64  
     protected final Collection<E> getCollection()
 65  
     {
 66  0
         return collection;
 67  
     }
 68  
 
 69  
     /** {@inheritDoc} */
 70  
     public boolean add(final E e)
 71  
     {
 72  0
         return collection.add(e);
 73  
     }
 74  
 
 75  
     /** {@inheritDoc} */
 76  
     public boolean addAll(final Collection<? extends E> c)
 77  
     {
 78  0
         return collection.addAll(c);
 79  
     }
 80  
 
 81  
     /** {@inheritDoc} */
 82  
     public void clear()
 83  
     {
 84  0
         collection.clear();
 85  0
     }
 86  
 
 87  
     /** {@inheritDoc} */
 88  
     public boolean contains(final Object o)
 89  
     {
 90  0
         return collection.contains(o);
 91  
     }
 92  
 
 93  
     /** {@inheritDoc} */
 94  
     public boolean containsAll(final Collection<?> c)
 95  
     {
 96  0
         return collection.containsAll(c);
 97  
     }
 98  
 
 99  
     /** {@inheritDoc} */
 100  
     public boolean equals(final Object o)
 101  
     {
 102  0
         return collection.equals(o);
 103  
     }
 104  
 
 105  
     /** {@inheritDoc} */
 106  
     public int hashCode()
 107  
     {
 108  0
         return collection.hashCode();
 109  
     }
 110  
 
 111  
     /** {@inheritDoc} */
 112  
     public boolean isEmpty()
 113  
     {
 114  0
         return collection.isEmpty();
 115  
     }
 116  
 
 117  
     /** {@inheritDoc} */
 118  
     public Iterator<E> iterator()
 119  
     {
 120  0
         return collection.iterator();
 121  
     }
 122  
 
 123  
     /** {@inheritDoc} */
 124  
     public boolean remove(final Object o)
 125  
     {
 126  0
         return collection.remove(o);
 127  
     }
 128  
 
 129  
     /** {@inheritDoc} */
 130  
     public boolean removeAll(final Collection<?> c)
 131  
     {
 132  0
         return collection.removeAll(c);
 133  
     }
 134  
 
 135  
     /** {@inheritDoc} */
 136  
     public boolean retainAll(final Collection<?> c)
 137  
     {
 138  0
         return collection.retainAll(c);
 139  
     }
 140  
 
 141  
     /** {@inheritDoc} */
 142  
     public int size()
 143  
     {
 144  0
         return collection.size();
 145  
     }
 146  
 
 147  
     /** {@inheritDoc} */
 148  
     public Object[] toArray()
 149  
     {
 150  0
         return collection.toArray();
 151  
     }
 152  
 
 153  
     /** {@inheritDoc} */
 154  
     public <T> T[] toArray(final T[] a)
 155  
     {
 156  0
         return collection.toArray(a);
 157  
     }
 158  
 }