com.tensegrity.graph.element
Class ElementPool

java.lang.Object
  extended bycom.tensegrity.graph.element.ElementPool

public class ElementPool
extends java.lang.Object

This class is a pool for elements. The elements are either the visual representations of nodes or edges. Elements are pooled by means of a HashMap internally. The elements must provide equals and hashcode methods, implementing Comparable is not required.

Version:
$Id: ElementPool.java,v 1.11 2005/12/12 15:26:07 MichaelKegel Exp $
Author:
StepanRutz, MichaelKegel
See Also:
GeometryPool, StylePool

Method Summary
static void clear()
          Clears the pool.
static void dump()
          Dumps the pool's contents to stderr.
static VisualGraphObject get(java.lang.String elementName)
          Returns an item from the pool by name.
static java.lang.String getDefaultVisualEdgeGeometry()
          Returns the name of the geometry that should be used by default for a VisualEdge automatically created by the GraphAPI.
static java.lang.String getDefaultVisualEdgeStyle()
          Returns the name of the style that should be used by default for a VisualEdge automatically created by the GraphAPI.
static java.util.Set names()
          Method names returns a set the keys of the internal map.
static void pool(java.lang.String elementName, VisualGraphObject visualgraphobject)
          Adds an item to the pool, if an item with the same name exists already, nothing will happen.
static int size()
          Returns the size of the pool.
static void useThreadLocal()
          A call to this method configures the ElementPool to make use of the ThreadLocal class hence a pool is created for each Thread the ElementPool 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 ElementPool to make use of the ThreadLocal class hence a pool is created for each Thread the ElementPool is used by.
Notice: This configuration must be done before the ElementPool is in use by any Thread.

See Also:
ThreadLocal

getDefaultVisualEdgeGeometry

public static final java.lang.String getDefaultVisualEdgeGeometry()
Returns the name of the geometry that should be used by default for a VisualEdge automatically created by the GraphAPI.

Returns:
String the name of the default-visualedge-geometry

getDefaultVisualEdgeStyle

public static final java.lang.String getDefaultVisualEdgeStyle()
Returns the name of the style that should be used by default for a VisualEdge automatically created by the GraphAPI.

Returns:
String the name of the default-visualedge-style

pool

public static final void pool(java.lang.String elementName,
                              VisualGraphObject visualgraphobject)
Adds an item to the pool, if an item with the same name exists already, nothing will happen.

Parameters:
elementName - the name of the element.
visualgraphobject - the VisualGraphObject to pool

get

public static final VisualGraphObject get(java.lang.String elementName)
Returns an item from the pool by name.

Parameters:
elementName - the name of the element.
Returns:
the element or null if the element was not pooled before.

size

public static final int size()
Returns the size of the pool.

Returns:
int the count of pooled elements.

names

public static final java.util.Set names()
Method names returns a set the keys of the internal map.

Returns:
Set the Set with all names of the currently pooled elements.

clear

public static final void clear()
Clears the pool.


dump

public static void dump()
Dumps the pool's contents to stderr.



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