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.
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. |
objectUsed
protected boolean[] objectUsed
Pool
public Pool(int maxSize)
- Creates a new object pool. The subclass must allocate the objects in
the pool.
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.