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:
Iterable, Collection, Set

public class CachedSetImpl
extends 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(Object o)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean equals(Object o)
           
 int hashCode()
           
 Iterator iterator()
           
 boolean remove(Object o)
           
 int size()
           
 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(Object o)
Specified by:
add in interface Collection
Specified by:
add in interface Set
Overrides:
add in class AbstractCollection

clear

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

contains

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

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface Set
Specified by:
iterator in class AbstractCollection

remove

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

size

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

toString

public String toString()
Overrides:
toString in class AbstractCollection

hashCode

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

equals

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


Copyright 2008 JBoss, a division of Red Hat. All Rights Reserved.