org.openmali.pooling
Class ObjectPool<T>

java.lang.Object
  extended by org.openmali.pooling.ObjectPool<T>
Direct Known Subclasses:
AxisAngle3fPool, ColordPool, ColorfPool, Matrix3fPool, Matrix4fPool, Point2dPool, Point2fPool, Point2iPool, Point3dPool, Point3fPool, Quaternion4fPool, Ray3fPool, TexCoord1fPool, TexCoord2fPool, TexCoord3fPool, TexCoord4fPool, Tuple2dPool, Tuple2fPool, Tuple2iPool, Tuple3dPool, Tuple3fPool, Tuple3iPool, Tuple4iPool, Vector2dPool, Vector2fPool, Vector2iPool, Vector3dPool, Vector3fPool, Vector4fPool

public abstract class ObjectPool<T>
extends java.lang.Object

Simple collection used to store free objects which we need to work with frequently. This is to solve some of the issues with garbage collection of frequently used objects


Constructor Summary
ObjectPool(int initialSize)
           
 
Method Summary
 T alloc()
           
 void free(T o)
           
 int getSize()
           
protected abstract  T newInstance()
          Creates a new instance of a pooled object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectPool

public ObjectPool(int initialSize)
Method Detail

getSize

public int getSize()

newInstance

protected abstract T newInstance()
Creates a new instance of a pooled object.

Returns:
the new object instance

alloc

public T alloc()

free

public void free(T o)