stamp.util
Class Pool

java.lang.Object
  |
  +--stamp.util.List
        |
        +--stamp.util.Pool
Direct Known Subclasses:
Cache

public abstract class Pool
extends List

Maintains a pool of reusable objects. When an object instance is needed it is checked out of the pool. When the object is no longer required it is checked back into the pool. This class should be subclassed for each object class that needs to be pooled.


Field Summary
protected  boolean[] objectUsed
           
 
Fields inherited from class stamp.util.List
list, numObjects
 
Constructor Summary
Pool(int maxSize)
          Creates a new object pool.
 
Method Summary
 void checkIn(Object buffer)
          Checks an object back into the pool when it is no longer needed.
 Object checkOut()
          Check an object out of the pool.
 
Methods inherited from class stamp.util.List
add, add, get, size
 
Methods inherited from class java.lang.Object
equals
 

Field Detail

objectUsed

protected boolean[] objectUsed
Constructor Detail

Pool

public Pool(int maxSize)
Creates a new object pool. The subclass must allocate the objects in the pool.
Method Detail

checkOut

public Object checkOut()
                throws IndexOutOfBoundsException
Check an object out of the pool.
Returns:
a free object instantance

checkIn

public void checkIn(Object buffer)
Checks an object back into the pool when it is no longer needed.