com.tensegrity.composite.geometry
Class GeometryItemPool

java.lang.Object
  extended bycom.tensegrity.composite.geometry.GeometryItemPool

public class GeometryItemPool
extends java.lang.Object

This class is a pool for GeometryItem instances.

Version:
$Id: GeometryItemPool.java,v 1.11 2005/12/12 15:20:46 MichaelKegel Exp $
Author:
MichaelKegel

Method Summary
static void clear()
          Clears the pool.
static void dump(java.io.PrintStream s)
          Dumps the pool to the PrintStream given by the parameter s.
static GeometryItem get(java.lang.String name)
          Returns the pooled GeometryItem stored under the given name.
static boolean isAvailable(java.lang.String name)
          Returns a boolean that indicates whether a GeometryItem with the name given by name is in the pool or not.
static java.util.Set names()
          Returns the names of all items as a Set.
static void pool(GeometryItem geometry)
          Pools the given GeometryItem under it's name.
static GeometryItem remove(java.lang.String name)
          Removes the GeometryItem with the given name from the pool.
static int size()
          Returns the count pooled GeometryItems.
static void useThreadLocal()
          A call to this method configures the GeometryItemPool to make use of the ThreadLocal class hence a pool is created for each Thread the GeometryItemPool is used by.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

useThreadLocal

public static final void useThreadLocal()
A call to this method configures the GeometryItemPool to make use of the ThreadLocal class hence a pool is created for each Thread the GeometryItemPool is used by.
Notice: This configuration must be done before the GeometryItemPool is in use by any Thread.

See Also:
ThreadLocal

isAvailable

public static final boolean isAvailable(java.lang.String name)
Returns a boolean that indicates whether a GeometryItem with the name given by name is in the pool or not.

Parameters:
name - the name of the GeometryItem to check
Returns:
boolean flag that indicates whether a GeometryItem with the given name is available or not

get

public static final GeometryItem get(java.lang.String name)
Returns the pooled GeometryItem stored under the given name.

Parameters:
name - the name of the GeometryItem to look up.
Returns:
the looked up GeometryItem; null if no such item exists within this pool.

pool

public static final void pool(GeometryItem geometry)
Pools the given GeometryItem under it's name.

Parameters:
geometry - the GeometryItem to pool.

remove

public static final GeometryItem remove(java.lang.String name)
Removes the GeometryItem with the given name from the pool.

Parameters:
name - the name of the GeometryItem to remove.
Returns:
the removed GeometryItem;null if no GeometryItem was found.

size

public static final int size()
Returns the count pooled GeometryItems.

Returns:
the count of pooled GeometryItem objects

clear

public static final void clear()
Clears the pool.


names

public static final java.util.Set names()
Returns the names of all items as a Set.

Returns:
the key set of the internally used Map.

dump

public static final void dump(java.io.PrintStream s)
Dumps the pool to the PrintStream given by the parameter s.

Parameters:
s - the PrintStream to dump the pool to


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.