Coverage Report - org.dishevelled.graph.impl.AbstractSetDecorator
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractSetDecorator
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.Set;
 28  
 import java.util.Iterator;
 29  
 
 30  
 /**
 31  
  * Abstract set that decorates an instance of <code>Set</code>.
 32  
  *
 33  
  * @param <E> set element type
 34  
  * @author  Michael Heuer
 35  
  * @version $Revision$ $Date$
 36  
  */
 37  
 abstract class AbstractSetDecorator<E>
 38  
     implements Set<E>
 39  
 {
 40  
     /** Set this decorator decorates. */
 41  
     private final Set<E> set;
 42  
 
 43  
 
 44  
     /**
 45  
      * Create a new abstract set that
 46  
      * decorates the specified set.
 47  
      *
 48  
      * @param set set to decorate, must not be null
 49  
      */
 50  
     protected AbstractSetDecorator(final Set<E> set)
 51  0
     {
 52  0
         if (set == null)
 53  
         {
 54  0
             throw new IllegalArgumentException("set must not be null");
 55  
         }
 56  0
         this.set = set;
 57  0
     }
 58  
 
 59  
 
 60  
     /**
 61  
      * Return a reference to the set this decorator decorates.
 62  
      *
 63  
      * @return a reference to the set this decorator decorates
 64  
      */
 65  
     protected final Set<E> getSet()
 66  
     {
 67  0
         return set;
 68  
     }
 69  
 
 70  
     /** {@inheritDoc} */
 71  
     public boolean add(final E e)
 72  
     {
 73  0
         return set.add(e);
 74  
     }
 75  
 
 76  
     /** {@inheritDoc} */
 77  
     public boolean addAll(final Collection<? extends E> c)
 78  
     {
 79  0
         return set.addAll(c);
 80  
     }
 81  
 
 82  
     /** {@inheritDoc} */
 83  
     public void clear()
 84  
     {
 85  0
         set.clear();
 86  0
     }
 87  
 
 88  
     /** {@inheritDoc} */
 89  
     public boolean contains(final Object o)
 90  
     {
 91  0
         return set.contains(o);
 92  
     }
 93  
 
 94  
     /** {@inheritDoc} */
 95  
     public boolean containsAll(final Collection<?> c)
 96  
     {
 97  0
         return set.containsAll(c);
 98  
     }
 99  
 
 100  
     /** {@inheritDoc} */
 101  
     public boolean equals(final Object o)
 102  
     {
 103  0
         return set.equals(o);
 104  
     }
 105  
 
 106  
     /** {@inheritDoc} */
 107  
     public int hashCode()
 108  
     {
 109  0
         return set.hashCode();
 110  
     }
 111  
 
 112  
     /** {@inheritDoc} */
 113  
     public boolean isEmpty()
 114  
     {
 115  0
         return set.isEmpty();
 116  
     }
 117  
 
 118  
     /** {@inheritDoc} */
 119  
     public Iterator<E> iterator()
 120  
     {
 121  0
         return set.iterator();
 122  
     }
 123  
 
 124  
     /** {@inheritDoc} */
 125  
     public boolean remove(final Object o)
 126  
     {
 127  0
         return set.remove(o);
 128  
     }
 129  
 
 130  
     /** {@inheritDoc} */
 131  
     public boolean removeAll(final Collection<?> c)
 132  
     {
 133  0
         return set.removeAll(c);
 134  
     }
 135  
 
 136  
     /** {@inheritDoc} */
 137  
     public boolean retainAll(final Collection<?> c)
 138  
     {
 139  0
         return set.retainAll(c);
 140  
     }
 141  
 
 142  
     /** {@inheritDoc} */
 143  
     public int size()
 144  
     {
 145  0
         return set.size();
 146  
     }
 147  
 
 148  
     /** {@inheritDoc} */
 149  
     public Object[] toArray()
 150  
     {
 151  0
         return set.toArray();
 152  
     }
 153  
 
 154  
     /** {@inheritDoc} */
 155  
     public <T> T[] toArray(final T[] a)
 156  
     {
 157  0
         return set.toArray(a);
 158  
     }
 159  
 }