org.jboss.cache.pojo.collection
Class CachedSetImpl

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet
          extended by org.jboss.cache.pojo.collection.CachedSetImpl
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.Set

public class CachedSetImpl
extends java.util.AbstractSet

Set implementation that uses a cache as an underlying backend store. Set data is stored in children nodes named based on the attached Object's hash code in hexidecimal string form. If there are conflicts between two Objects with the same hash code, then a counter (upper 32 bits of 64) is used.

Author:
Ben Wang, Scott Marlow, Jussi Pyorre

Constructor Summary
CachedSetImpl(PojoCacheImpl cache, AbstractCollectionInterceptor interceptor)
           
 
Method Summary
 boolean add(java.lang.Object o)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object o)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.util.AbstractSet
removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, isEmpty, retainAll, toArray, toArray
 

Constructor Detail

CachedSetImpl

public CachedSetImpl(PojoCacheImpl cache,
                     AbstractCollectionInterceptor interceptor)
Method Detail

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class java.util.AbstractCollection

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set
Overrides:
clear in class java.util.AbstractCollection

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
Overrides:
contains in class java.util.AbstractCollection

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Specified by:
iterator in class java.util.AbstractCollection

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
Overrides:
remove in class java.util.AbstractCollection

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set
Specified by:
size in class java.util.AbstractCollection

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.Set
Overrides:
hashCode in class java.util.AbstractSet

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.Set
Overrides:
equals in class java.util.AbstractSet