FindBugs™ 1.3.9

edu.umd.cs.findbugs
Class ResourceCollection<Resource>

java.lang.Object
  extended by edu.umd.cs.findbugs.ResourceCollection<Resource>

public class ResourceCollection<Resource>
extends java.lang.Object

A ResourceCollection defines all of the resources created and used in a particular method. It serves two related purposes:

  1. Define all of the resources which exist in the method, and
  2. Record where resources created in the method are created

This distinction is important because some resources which exist in the method aren't created in the method: for example, resources passed in as parameters.

Author:
David Hovemeyer

Constructor Summary
ResourceCollection()
          Constructor.
 
Method Summary
 void addCreatedResource(Location location, Resource resource)
          Add a resource created within the analyzed method.
 void addPreexistingResource(Resource resource)
          Add a preexisting resource.
 Resource getCreatedResource(Location location)
          Get the resource that is created at given location.
 boolean isEmpty()
          Return whether or not there are any resources in the collection.
 java.util.Iterator<Resource> resourceIterator()
          Get an Iterator over all resources in the method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceCollection

public ResourceCollection()
Constructor. Creates empty collection.

Method Detail

addPreexistingResource

public void addPreexistingResource(Resource resource)
Add a preexisting resource. That is, one that is not created within the analyzed method. Resources passed to the method as parameters fall into this category.

Parameters:
resource - the preexisting resource

addCreatedResource

public void addCreatedResource(Location location,
                               Resource resource)
Add a resource created within the analyzed method.

Parameters:
location - the location
resource - the resource created at that location

isEmpty

public boolean isEmpty()
Return whether or not there are any resources in the collection.


resourceIterator

public java.util.Iterator<Resource> resourceIterator()
Get an Iterator over all resources in the method. This includes both preexisting and created resources.


getCreatedResource

public Resource getCreatedResource(Location location)
Get the resource that is created at given location.

Parameters:
location - the Location
Returns:
the Resource created at that location, or null if no resource is created at the location

FindBugs™ 1.3.9

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.