com.tensegrity.composite.coordinate
Class ScalePool

java.lang.Object
  extended bycom.tensegrity.composite.coordinate.ScalePool

public final class ScalePool
extends java.lang.Object

Class ScalePool defines the needed facility to pool created Scale instances. This class is responsible for maintaining global references to Scale objects needed by multiple clients.

This class has no public constructor. Use the static class methods directly.

While it is possible to remove all pooled Scale objects by invoking the clear() method, this should only be done when you are sure that all pooled objects are no longer being referenced by any other object. The actual number of pooled Scale objects can be determined by invoking the size() method. Additionally, the ScalePool can parse a canonical description and return a new or existing Scale when you invoke the parse(java.lang.String) method.

Version:
$Id: ScalePool.java,v 1.6 2005/03/14 14:36:12 AndreasEbbert Exp $
Author:
MichaelKegel

Method Summary
static void clear()
          Removes all the pooled Scales from the ScalePool.
static void dump(java.io.PrintStream s)
          Dumps the ScalePool to the PrintStream given by s.
static Scale parse(java.lang.String description)
          Parses the canonical description of a Scale given by description and pools a new instance if necessary.
static int size()
          Returns the number of the Scales actually pooled in the .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parse

public static final Scale parse(java.lang.String description)
                         throws ScaleParseException
Parses the canonical description of a Scale given by description and pools a new instance if necessary. The returned value is an instance of the Scale that is described by description.

Parameters:
description - the canonical description of a Scale
Returns:
Scale the instance of the Scale
Throws:
ScaleParseException - is thrown when an error occurs while parsing the canonical description of the Scale

size

public static final int size()
Returns the number of the Scales actually pooled in the .

Returns:
int the number of pooled Scales

clear

public static final void clear()
Removes all the pooled Scales from the ScalePool. Notice that this only can be done when it is sure that the pooled Scales are no longer referenced by any object. Otherwise these objects have a weak reference.


dump

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

Parameters:
s - the PrintStream to dump the ScalePool to


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