Coverage Report - net.sourceforge.combean.graph.containers.SetAsNodeSet
 
Classes in this File Line Coverage Branch Coverage Complexity
SetAsNodeSet
100%
13/13
N/A
0
 
 1  
 /*
 2  
     This file is part of Combean.
 3  
 
 4  
     Combean is free software; you can redistribute it and/or modify
 5  
     it under the terms of the GNU General Public License as published by
 6  
     the Free Software Foundation; either version 2 of the License, or
 7  
     (at your option) any later version.
 8  
 
 9  
     Combean is distributed in the hope that it will be useful,
 10  
     but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  
     GNU General Public License for more details.
 13  
 
 14  
     You should have received a copy of the GNU General Public License
 15  
     along with Combean; if not, write to the Free Software
 16  
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 17  
 */
 18  
 /*
 19  
  * Created on 14.01.2005
 20  
  *
 21  
  */
 22  
 package net.sourceforge.combean.graph.containers;
 23  
 
 24  
 import java.util.Set;
 25  
 
 26  
 import net.sourceforge.combean.graph.iterators.IteratorAsNodeIterator;
 27  
 import net.sourceforge.combean.interfaces.graph.Node;
 28  
 import net.sourceforge.combean.interfaces.graph.NodeIterator;
 29  
 import net.sourceforge.combean.interfaces.graph.containers.NodeSet;
 30  
 
 31  
 /**
 32  
  * A wrapper which turns a java.lang.util.Set into a NodeSet.
 33  
  * 
 34  
  * @author schickin
 35  
  *
 36  
  */
 37  
 public class SetAsNodeSet implements NodeSet {
 38  
 
 39  63
         private Set<Node> implSet = null;
 40  
         
 41  
         /**
 42  
          * Construct NodeSet wrapper for java.lang.util.Set
 43  
          * 
 44  
          * @param implSet the Set to be wrapped
 45  
          */
 46  
         public SetAsNodeSet(Set<Node> implSet) {
 47  63
                 super();
 48  63
                 this.implSet = implSet;
 49  63
         }
 50  
 
 51  
         /**
 52  
          * @see net.sourceforge.combean.interfaces.graph.containers.NodeSet#add(net.sourceforge.combean.interfaces.graph.Node)
 53  
          */
 54  
         public final boolean add(Node v) {
 55  306
                 return this.implSet.add(v);
 56  
         }
 57  
 
 58  
         /**
 59  
          * @see net.sourceforge.combean.interfaces.graph.containers.NodeSet#remove(net.sourceforge.combean.interfaces.graph.Node)
 60  
          */
 61  
         public final boolean remove(Node v) {
 62  9
                 return this.implSet.remove(v);
 63  
         }
 64  
 
 65  
         /**
 66  
          * @see net.sourceforge.combean.interfaces.graph.containers.NodeSet#clear()
 67  
          */
 68  
         public final void clear() {
 69  48
                 this.implSet.clear();
 70  48
         }
 71  
 
 72  
         /**
 73  
          * @see net.sourceforge.combean.interfaces.graph.containers.FixedNodeSet#size()
 74  
          */
 75  
         public final int size() {
 76  15
                 return this.implSet.size();
 77  
         }
 78  
 
 79  
         /**
 80  
          * @see net.sourceforge.combean.interfaces.graph.containers.FixedNodeSet#contains(net.sourceforge.combean.interfaces.graph.Node)
 81  
          */
 82  
         public final boolean contains(Node v) {
 83  75
                 return this.implSet.contains(v);
 84  
         }
 85  
 
 86  
         /**
 87  
          * @see net.sourceforge.combean.interfaces.graph.containers.FixedNodeCollection#iterator()
 88  
          */
 89  
         public final NodeIterator iterator() {
 90  3
                 return new IteratorAsNodeIterator(this.implSet.iterator());
 91  
         }
 92  
 
 93  
         /**
 94  
          * @see net.sourceforge.combean.interfaces.graph.containers.FixedNodeCollection#isEmpty()
 95  
          */
 96  
         public final boolean isEmpty() {
 97  15
                 return this.implSet.isEmpty();
 98  
         }
 99  
 
 100  
         /**
 101  
          * @return the java.util.Set instance which is used for implementing the
 102  
          * NodeSet
 103  
          */
 104  
         public final Set getImplementation() {
 105  12
             return this.implSet;
 106  
         }
 107  
 }