edu.cmu.sphinx.linguist.acoustic.tiedstate
Class Pool<T>

java.lang.Object
  extended by edu.cmu.sphinx.linguist.acoustic.tiedstate.Pool<T>

public class Pool<T>
extends java.lang.Object

Used to pool shared objects in the acoustic model


Nested Class Summary
static class Pool.Feature
           
 
Constructor Summary
Pool(java.lang.String name)
          Creates a new pool.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pool

public Pool(java.lang.String name)
Creates a new pool.

Parameters:
name - the name of the pool
Method Detail

getName

public java.lang.String getName()
Returns the pool's name.

Returns:
the pool name

get

public T get(int id)
Returns the object with the given ID from the pool.

Parameters:
id - the id of the object
Returns:
the object
Throws:
java.lang.IndexOutOfBoundsException - if the ID is out of range

indexOf

public int indexOf(T object)
Returns the ID of a given object from the pool.

Parameters:
object - the object
Returns:
the index

put

public void put(int id,
                T o)
Places the given object in the pool.

Parameters:
id - a unique ID for this object
o - the object to add to the pool

size

public int size()
Retrieves the size of the pool.

Returns:
the size of the pool

logInfo

public void logInfo(java.util.logging.Logger logger)
Dump information on this pool to the given logger.

Parameters:
logger - the logger to send the info to

setFeature

public void setFeature(Pool.Feature feature,
                       int value)
Sets a feature for this pool.

Parameters:
feature - feature to set
value - the value for the feature

getFeature

public int getFeature(Pool.Feature feature,
                      int defaultValue)
Retrieves a feature from this pool.

Parameters:
feature - feature to get
defaultValue - the defaultValue for the pool
Returns:
the value for the feature