public class AtomTypeFactory extends Object
To see which AtomTypeConfigurator's CDK provides, one should check the AtomTypeConfigurator API.
The AtomTypeFactory is a singleton class, which means that there exists only one instance of the class. Well, almost. For each atom type table, there is one AtomTypeFactory instance. An instance of this class is obtained with:
AtomTypeFactory factory = AtomTypeFactory.getInstance(someChemObjectBuilder);For each atom type list a separate AtomTypeFactory is instantiated.
To get all the atom types of an element from a specific list, this code can be used:
AtomTypeFactory factory = AtomTypeFactory.getInstance( "org/openscience/cdk/config/data/jmol_atomtypes.txt", someChemObjectBuilder ); AtomType[] types = factory.getAtomTypes("C");
IAtomTypeConfigurator
Modifier and Type | Field and Description |
---|---|
static String |
ATOMTYPE_ID_JMOL
Used as an ID to describe the atom type.
|
static String |
ATOMTYPE_ID_MODELING
Used as an ID to describe the atom type.
|
static String |
ATOMTYPE_ID_STRUCTGEN
Used as an ID to describe the atom type.
|
Modifier and Type | Method and Description |
---|---|
IAtom |
configure(IAtom atom)
Configures an atom.
|
IAtomType[] |
getAllAtomTypes()
Gets the allAtomTypes attribute of the AtomTypeFactory object.
|
IAtomType |
getAtomType(String identifier)
Get an AtomType with the given ID.
|
IAtomType[] |
getAtomTypes(String symbol)
Get an array of all atomTypes known to the AtomTypeFactory for the given
element symbol and atomtype class.
|
static AtomTypeFactory |
getInstance(IChemObjectBuilder builder)
Method to create a default AtomTypeFactory, using the structgen atom type list.
|
static AtomTypeFactory |
getInstance(InputStream ins,
String format,
IChemObjectBuilder builder)
Method to create a default AtomTypeFactory, using the given InputStream.
|
static AtomTypeFactory |
getInstance(String configFile,
IChemObjectBuilder builder)
Method to create a specialized AtomTypeFactory.
|
int |
getSize()
Returns the number of atom types in this list.
|
public static final String ATOMTYPE_ID_STRUCTGEN
public static final String ATOMTYPE_ID_MODELING
public static final String ATOMTYPE_ID_JMOL
public static AtomTypeFactory getInstance(InputStream ins, String format, IChemObjectBuilder builder)
ins
- InputStream containing the dataformat
- String representing the possible formats ('xml' and 'txt')builder
- IChemObjectBuilder used to make IChemObject instancesgetInstance(String, IChemObjectBuilder)
public static AtomTypeFactory getInstance(IChemObjectBuilder builder)
builder
- IChemObjectBuilder used to make IChemObject instancesgetInstance(String, IChemObjectBuilder)
public static AtomTypeFactory getInstance(String configFile, IChemObjectBuilder builder)
configFile
- String the name of the data filebuilder
- INewChemObjectBuilder used to make IChemObject instancespublic int getSize()
public IAtomType getAtomType(String identifier) throws NoSuchAtomTypeException
identifier
- an ID for a particular atom type (like C$)NoSuchAtomTypeException
- Thrown if the atom type does not exist.public IAtomType[] getAtomTypes(String symbol)
symbol
- An element symbol to search forpublic IAtomType[] getAllAtomTypes()
public IAtom configure(IAtom atom) throws CDKException
atom
- The atom to be configuredCDKException
- when it could not recognize and configure the
IAtomCopyright © 2018. All Rights Reserved.