FileDocCategorySizeDatePackage
ResourceSet.javaAPI DocApache Tomcat 6.0.144717Fri Jul 20 04:20:32 BST 2007org.apache.catalina.util

ResourceSet

public final class ResourceSet extends HashSet
Extended implementation of HashSet that includes a locked property. This class can be used to safely expose resource path sets to user classes without having to clone them in order to avoid modifications. When first created, a ResourceMap is not locked.
author
Craig R. McClanahan
version
$Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $

Fields Summary
private boolean
locked
The current lock state of this parameter map.
private static final StringManager
sm
The string manager for this package.
Constructors Summary
public ResourceSet()
Construct a new, empty set with the default initial capacity and load factor.


        super();

    
public ResourceSet(int initialCapacity)
Construct a new, empty set with the specified initial capacity and default load factor.

param
initialCapacity The initial capacity of this set


        super(initialCapacity);

    
public ResourceSet(int initialCapacity, float loadFactor)
Construct a new, empty set with the specified initial capacity and load factor.

param
initialCapacity The initial capacity of this set
param
loadFactor The load factor of this set


        super(initialCapacity, loadFactor);

    
public ResourceSet(Collection coll)
Construct a new set with the same contents as the existing collection.

param
coll The collection whose contents we should copy


        super(coll);

    
Methods Summary
public booleanadd(java.lang.Object o)
Add the specified element to this set if it is not already present. Return true if the element was added.

param
o The object to be added
exception
IllegalStateException if this ResourceSet is locked



    // --------------------------------------------------------- Public Methods


                                           
        

        if (locked)
            throw new IllegalStateException
              (sm.getString("resourceSet.locked"));
        return (super.add(o));

    
public voidclear()
Remove all of the elements from this set.

exception
IllegalStateException if this ResourceSet is locked


        if (locked)
            throw new IllegalStateException
              (sm.getString("resourceSet.locked"));
        super.clear();

    
public booleanisLocked()
Return the locked state of this parameter map.



                 
       

        return (this.locked);

    
public booleanremove(java.lang.Object o)
Remove the given element from this set if it is present. Return true if the element was removed.

param
o The object to be removed
exception
IllegalStateException if this ResourceSet is locked


        if (locked)
            throw new IllegalStateException
              (sm.getString("resourceSet.locked"));
        return (super.remove(o));

    
public voidsetLocked(boolean locked)
Set the locked state of this parameter map.

param
locked The new locked state


        this.locked = locked;