Coverage Report - org.mule.util.concurrent.ConcurrentHashSet
 
Classes in this File Line Coverage Branch Coverage Complexity
ConcurrentHashSet
0%
0/29
0%
0/2
1
 
 1  
 /*
 2  
  * $Id: ConcurrentHashSet.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.util.concurrent;
 12  
 
 13  
 /*
 14  
  * Written by Doug Lea with assistance from members of JCP JSR-166 Expert Group and
 15  
  * released to the public domain, as explained at
 16  
  * http://creativecommons.org/licenses/publicdomain
 17  
  */
 18  
 
 19  
 import java.io.IOException;
 20  
 import java.io.Serializable;
 21  
 import java.util.AbstractSet;
 22  
 import java.util.Collection;
 23  
 import java.util.Iterator;
 24  
 import java.util.Set;
 25  
 
 26  
 import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
 27  
 
 28  
 public class ConcurrentHashSet/* <E> */extends AbstractSet/* <E> */implements Set/* <E> */, Serializable
 29  
 {
 30  
     private static final long serialVersionUID = 2454657854757543876L;
 31  
 
 32  
     private final ConcurrentHashMap/* <E, Boolean> */map;
 33  
     private transient Set/* <E> */keySet;
 34  
 
 35  
     public ConcurrentHashSet()
 36  0
     {
 37  0
         map = new ConcurrentHashMap/* <E, Boolean> */();
 38  0
         keySet = map.keySet();
 39  0
     }
 40  
 
 41  
     public ConcurrentHashSet(int initialCapacity)
 42  0
     {
 43  0
         map = new ConcurrentHashMap/* <E, Boolean> */(initialCapacity);
 44  0
         keySet = map.keySet();
 45  0
     }
 46  
 
 47  
     public ConcurrentHashSet(int initialCapacity, float loadFactor, int concurrencyLevel)
 48  0
     {
 49  0
         map = new ConcurrentHashMap/* <E, Boolean> */(initialCapacity, loadFactor, concurrencyLevel);
 50  0
         keySet = map.keySet();
 51  0
     }
 52  
 
 53  
     public int size()
 54  
     {
 55  0
         return map.size();
 56  
     }
 57  
 
 58  
     public boolean isEmpty()
 59  
     {
 60  0
         return map.isEmpty();
 61  
     }
 62  
 
 63  
     public boolean contains(Object o)
 64  
     {
 65  0
         return map.containsKey(o);
 66  
     }
 67  
 
 68  
     public Iterator/* <E> */iterator()
 69  
     {
 70  0
         return keySet.iterator();
 71  
     }
 72  
 
 73  
     public Object[] toArray()
 74  
     {
 75  0
         return keySet.toArray();
 76  
     }
 77  
 
 78  
     public/* <T> T[] */Object[] toArray(Object[]/* T[] */a)
 79  
     {
 80  0
         return keySet.toArray(a);
 81  
     }
 82  
 
 83  
     public boolean add(Object/* E */e)
 84  
     {
 85  0
         return map.put(e, Boolean.TRUE) == null;
 86  
     }
 87  
 
 88  
     public boolean remove(Object o)
 89  
     {
 90  0
         return map.remove(o) != null;
 91  
     }
 92  
 
 93  
     public boolean removeAll(Collection/* <?> */c)
 94  
     {
 95  0
         return keySet.removeAll(c);
 96  
     }
 97  
 
 98  
     public boolean retainAll(Collection/* <?> */c)
 99  
     {
 100  0
         return keySet.retainAll(c);
 101  
     }
 102  
 
 103  
     public void clear()
 104  
     {
 105  0
         map.clear();
 106  0
     }
 107  
 
 108  
     public boolean equals(Object o)
 109  
     {
 110  0
         return keySet.equals(o);
 111  
     }
 112  
 
 113  
     public int hashCode()
 114  
     {
 115  0
         return keySet.hashCode();
 116  
     }
 117  
 
 118  
     private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException
 119  
     {
 120  0
         s.defaultReadObject();
 121  0
         keySet = map.keySet();
 122  0
     }
 123  
 
 124  
 }