Colt 1.0.3

edu.oswego.cs.dl.util.concurrent
Class SyncSet

java.lang.Object
  |
  +--edu.oswego.cs.dl.util.concurrent.SyncCollection
        |
        +--edu.oswego.cs.dl.util.concurrent.SyncSet
All Implemented Interfaces:
Collection, Set
Direct Known Subclasses:
SyncSortedSet

public class SyncSet
extends SyncCollection
implements Set

SyncSets wrap Sync-based control around java.util.Sets. They support two additional reader operations than do SyncCollection: hashCode and equals.

[ Introduction to this package. ]

See Also:
SyncCollection

Inner classes inherited from class edu.oswego.cs.dl.util.concurrent.SyncCollection
SyncCollection.SyncCollectionIterator
 
Constructor Summary
SyncSet(Set set, ReadWriteLock rwl)
          Create a new SyncSet protecting the given set, and using the given ReadWriteLock to control reader and writer methods.
SyncSet(Set set, Sync sync)
          Create a new SyncSet protecting the given collection, and using the given sync to control both reader and writer methods.
SyncSet(Set set, Sync readLock, Sync writeLock)
          Create a new SyncSet protecting the given set, and using the given pair of locks to control reader and writer methods.
 
Method Summary
 boolean equals(Object o)
           
 int hashCode()
           
 
Methods inherited from class edu.oswego.cs.dl.util.concurrent.SyncCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, readerSync, remove, removeAll, retainAll, size, syncFailures, toArray, toArray, unprotectedIterator, writerSync
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

SyncSet

public SyncSet(Set set,
               Sync sync)
Create a new SyncSet protecting the given collection, and using the given sync to control both reader and writer methods. Common, reasonable choices for the sync argument include Mutex, ReentrantLock, and Semaphores initialized to 1.

SyncSet

public SyncSet(Set set,
               ReadWriteLock rwl)
Create a new SyncSet protecting the given set, and using the given ReadWriteLock to control reader and writer methods.

SyncSet

public SyncSet(Set set,
               Sync readLock,
               Sync writeLock)
Create a new SyncSet protecting the given set, and using the given pair of locks to control reader and writer methods.
Method Detail

hashCode

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

equals

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

Colt 1.0.3

Submit a bug or feature. Check the Colt home page for the latest news.