gzz.util
Class Pool.AbstractPoolable

java.lang.Object
  |
  +--gzz.util.Pool.AbstractPoolable
All Implemented Interfaces:
Pool.Poolable
Enclosing class:
Pool

public static class Pool.AbstractPoolable
extends java.lang.Object
implements Pool.Poolable

An abstract implementation of Poolable. This should be subclassed instead of implementing Poolable whereever possible. The only reason for implementing Poolable instead is subclassing a non-Poolable class and intending to create a Pool for that class. (When implementing Poolable directly, it will normally suffice to copy&paste the whole body of AbstractPoolable into the implementing class.)


Constructor Summary
Pool.AbstractPoolable()
           
 
Method Summary
 void release()
          Release this Poolable instance.
 void setPool(Pool pool, int poolIndex)
          Store the information necessary for releasing this poolable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pool.AbstractPoolable

public Pool.AbstractPoolable()
Method Detail

setPool

public final void setPool(Pool pool,
                          int poolIndex)
Description copied from interface: Pool.Poolable
Store the information necessary for releasing this poolable. Poolable.release() needs two informations to work correctly: the Pool this Poolable is stored in, and the index of this Poolable inside that Pool.

Specified by:
setPool in interface Pool.Poolable

release

public final void release()
Description copied from interface: Pool.Poolable
Release this Poolable instance. Makes this instance available for future use. This is never called by Pool; rather, it exists here as a convention for naming this functionality.

This must not do anything if setPool has never been called. Otherwise, must call pool.release(poolIndex), where pool and poolIndex are the parameters passed to the last setPool call.

Specified by:
release in interface Pool.Poolable