public class Pool<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Pool.Feature |
Constructor and Description |
---|
Pool(java.lang.String name)
Creates a new pool.
|
Modifier and Type | Method and Description |
---|---|
T |
get(int id)
Returns the object with the given ID from the pool.
|
int |
getFeature(Pool.Feature feature,
int defaultValue)
Retrieves a feature from this pool.
|
java.lang.String |
getName()
Returns the pool's name.
|
int |
indexOf(T object)
Returns the ID of a given object from the pool.
|
void |
logInfo(java.util.logging.Logger logger)
Dump information on this pool to the given logger.
|
void |
put(int id,
T o)
Places the given object in the pool.
|
void |
setFeature(Pool.Feature feature,
int value)
Sets a feature for this pool.
|
int |
size()
Retrieves the size of the pool.
|
public Pool(java.lang.String name)
name
- the name of the poolpublic java.lang.String getName()
public T get(int id)
id
- the id of the objectjava.lang.IndexOutOfBoundsException
- if the ID is out of rangepublic int indexOf(T object)
object
- the objectpublic void put(int id, T o)
id
- a unique ID for this objecto
- the object to add to the poolpublic int size()
public void logInfo(java.util.logging.Logger logger)
logger
- the logger to send the info topublic void setFeature(Pool.Feature feature, int value)
feature
- feature to setvalue
- the value for the featurepublic int getFeature(Pool.Feature feature, int defaultValue)
feature
- feature to getdefaultValue
- the defaultValue for the pool