com.sun.sgs.impl.util
Class BindingKeyedSetImpl<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by com.sun.sgs.impl.util.BindingKeyedSetImpl<E>
Type Parameters:
E - the element type
All Implemented Interfaces:
BindingKeyedSet<E>, Serializable, Iterable<E>, Collection<E>, Set<E>

public class BindingKeyedSetImpl<E>
extends AbstractSet<E>
implements BindingKeyedSet<E>, Serializable

An implementation of BindingKeyedSet backed by a BindingKeyedMap.

See Also:
Serialized Form

Constructor Summary
BindingKeyedSetImpl(String keyPrefix)
          Creates an empty set with the specified keyPrefix.
 
Method Summary
 boolean add(E e)
          Adds the specified element to this set if it was not already present.
 void clear()
          
 boolean contains(Object o)
          Returns true if this set contains the specified element.
 String getKeyPrefix()
          Returns the key prefix for this set.
 boolean isEmpty()
          
 Iterator<E> iterator()
          Returns a Serializable Iterator over the elements in this set.
 boolean remove(Object o)
          Removes the specified element from this set if it was present.
 boolean retainAll(Collection<?> c)
          
 int size()
          
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, toArray, toArray
 

Constructor Detail

BindingKeyedSetImpl

BindingKeyedSetImpl(String keyPrefix)
Creates an empty set with the specified keyPrefix.

Parameters:
keyPrefix - the key prefix for a service binding name
Throws:
IllegalArgumentException - if keyPrefix is empty
Method Detail

getKeyPrefix

public String getKeyPrefix()
Returns the key prefix for this set.

Specified by:
getKeyPrefix in interface BindingKeyedSet<E>
Returns:
the key prefix for this set

add

public boolean add(E e)
Adds the specified element to this set if it was not already present.

Specified by:
add in interface BindingKeyedSet<E>
Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>
Overrides:
add in class AbstractCollection<E>
Parameters:
e - the element to be added
Returns:
true if the set did not already contain the specified element

clear

public void clear()

Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>
Overrides:
clear in class AbstractCollection<E>

contains

public boolean contains(Object o)
Returns true if this set contains the specified element.

Specified by:
contains in interface BindingKeyedSet<E>
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface Set<E>
Overrides:
contains in class AbstractCollection<E>
Parameters:
o - the element whose presence in the set is to be tested
Returns:
true if this set contains the specified element, and false otherwise

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>
Overrides:
isEmpty in class AbstractCollection<E>

iterator

public Iterator<E> iterator()
Returns a Serializable Iterator over the elements in this set. The next method of the returned Iterator throws ObjectNotFoundException if the next element in the set is a managed object that has been removed from the DataManager.

Specified by:
iterator in interface BindingKeyedSet<E>
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>
Specified by:
iterator in class AbstractCollection<E>
Returns:
an iterator over the elements in this set

remove

public boolean remove(Object o)
Removes the specified element from this set if it was present.

Specified by:
remove in interface BindingKeyedSet<E>
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>
Overrides:
remove in class AbstractCollection<E>
Parameters:
o - the element that should be removed from the set, if present
Returns:
true if the element was initially present in this set

size

public int size()

Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>
Specified by:
size in class AbstractCollection<E>

retainAll

public boolean retainAll(Collection<?> c)

Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>
Overrides:
retainAll in class AbstractCollection<E>

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved