amwebarsentitlementservice.elementpool
Class PoolManager

java.lang.Object
  |
  +--amwebarsentitlementservice.elementpool.PoolManager

public class PoolManager
extends java.lang.Object


Field Summary
static int DEFAULT_CAPACITY
           
static boolean LINEAR_GROWTH
           
static int LINEAR_GROWTH_BY
           
 
Constructor Summary
PoolManager(int capacity, PoolElement prototype)
           
PoolManager(int capacity, PoolElement prototype, boolean growable)
          Constructor for PoolManager.
PoolManager(PoolElement prototype)
           
 
Method Summary
 int capacity()
           
 PoolElement getElement()
          Retrieves a element of the PoolManager.
 boolean isEmpty()
           
 void returnElement(PoolElement element)
          Returns a element previously obtained from the pool back to it.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CAPACITY

public static final int DEFAULT_CAPACITY

LINEAR_GROWTH

public static final boolean LINEAR_GROWTH

LINEAR_GROWTH_BY

public static final int LINEAR_GROWTH_BY
Constructor Detail

PoolManager

public PoolManager(PoolElement prototype)

PoolManager

public PoolManager(int capacity,
                   PoolElement prototype)

PoolManager

public PoolManager(int capacity,
                   PoolElement prototype,
                   boolean growable)
Constructor for PoolManager.
Method Detail

getElement

public PoolElement getElement()
Retrieves a element of the PoolManager. If the pool is empty and growth is allowed the pool's size is raised by a fixed value or doubled.
Returns:
element of the pool

returnElement

public void returnElement(PoolElement element)
Returns a element previously obtained from the pool back to it. The elements status is cleared by calling the clearInternalStatus method of the element.
Parameters:
element - PoolElement previously obtained

size

public int size()

isEmpty

public boolean isEmpty()

capacity

public int capacity()