// $Id: AtomRadiusRegistry.java,v 1.1 2006/05/20 17:02:03 Sasha Buzko Exp $ // // Copyright (c) 2000-2002 San Diego Supercomputer Center (SDSC), // a facility operated jointly by the University of California, // San Diego (UCSD) and General Atomics, San Diego, California, USA. // // Users and possessors of this source code are hereby granted a // nonexclusive, royalty-free copyright and design patent license to // use this code in individual software. License is not granted for // commercial resale, in whole or in part, without prior written // permission from SDSC. This source is provided "AS IS" without express // or implied warranty of any kind. // // For further information, please see: http://mbt.sdsc.edu // // History: // $Log: AtomRadiusRegistry.java,v $ // Revision 1.1 2006/05/20 17:02:03 Sasha Buzko // Updated version // // Revision 1.1 2006/04/30 20:13:58 Sasha Buzko // New version of the app // // Revision 1.1 2006/04/15 19:42:21 Sasha Buzko // Initial commit // // Revision 1.1 2005/11/13 04:35:14 Administrator // *** empty log message *** // // Revision 1.2 2003/09/16 21:09:05 moreland // Renamed "AtomRadiusByElement" to "AtomRadiusByCpk". // Added "AtomRadiusByScaledCpk" class. // // Revision 1.1 2003/02/27 21:06:33 moreland // Began adding classes for viewable "Styles" (colors, sizes, forms, etc). // // Revision 1.0 2003/06/10 23:38:39 moreland // First version. // package edu.sdsc.mbt.viewables; import java.util.Enumeration; import java.util.Hashtable; /** * A class used to register AtomRadius implementation objects. * The names of the AtomRadius objects can be retrieved and * used in a GUI menu in order for a user to pick the desired * AtomRadius algorithm. The retrieved AtomRadius object may then be * handed to a StructureStyle instance in order to assocate one * or more Atom representations to a given radius scheme. *

* @see edu.sdsc.mbt.viewables.AtomRadius * @see edu.sdsc.mbt.viewables.StructureStyles *

* @author John L. Moreland */ public class AtomRadiusRegistry { // The registered AtomRadius objects private static Hashtable atomRadiusObjects = new Hashtable( ); // The default AtomRadius object name private static String defaultName = null; // Add the well-known AtomRadius implementation names. static { add( AtomRadiusByCpk.NAME, AtomRadiusByCpk.create() ); add( AtomRadiusByScaledCpk.NAME, AtomRadiusByScaledCpk.create() ); add( AtomRadiusByConstant.NAME, AtomRadiusByConstant.create() ); defaultName = AtomRadiusByConstant.NAME; } // // Registration methods // /** * Return the number of registered AtomRadius impelementations. */ public static int count( ) { return atomRadiusObjects.size( ); } /** * Return the name of the default AtomRadius impelementation. */ public static String getDefaultName( ) { return defaultName; } /** * Add a new AtomRadius implementation. */ public static void add( String name, AtomRadius atomRadius ) { atomRadiusObjects.put( name, atomRadius ); } /** * Remove an existing AtomRadius implementation. */ public static void remove( String name ) { atomRadiusObjects.remove( name ); } /** * Get an AtomRadius implementation by name. */ public static AtomRadius get( String name ) { return (AtomRadius) atomRadiusObjects.get( name ); } /** * Get the default AtomRadius implementation. */ public static AtomRadius getDefault( ) { return (AtomRadius) atomRadiusObjects.get( defaultName ); } /** * Return an Enumeration of String values for all registered * AtomRadius objects. */ public static Enumeration names( ) { return atomRadiusObjects.keys( ); } }