public class DefaultChemObjectBuilder extends Object implements IChemObjectBuilder
ICDKObject
s.
IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
IAtom a = builder.newInstance(IAtom.class);
IAtom c12 = builder.newInstance(IAtom.class, "C");
IAtom c13 = builder.newInstance(IAtom.class,
builder.newInstance(IIsotope.class,
"C", 13));
Modifier and Type | Method and Description |
---|---|
static IChemObjectBuilder |
getInstance()
Access the singleton instance of this DefaultChemObjectBuilder.
|
IAtom |
newAtom()
Create a new atom using the default constructor.
|
IAtomContainer |
newAtomContainer()
Create a new atom container using the default constructor.
|
IBond |
newBond()
Create a new bond using the default constructor.
|
<T extends ICDKObject> |
newInstance(Class<T> clazz,
Object... params)
Creates a new instance of an
ICDKObject , using the constructor defined by the
given parameters. |
public static IChemObjectBuilder getInstance()
// get the builder instance
IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
// using the builder...
// create an IAtom using the default constructor
IAtom atom = builder.newInstance(IAtom.class);
// create a carbon atom
IAtom c1 = builder.newInstance(IAtom.class, "C");
public <T extends ICDKObject> T newInstance(Class<T> clazz, Object... params)
ICDKObject
, using the constructor defined by the
given parameters.newInstance
in interface IChemObjectBuilder
T
- Class of an interface extending ICDKObject
or ICDKObject
itself.clazz
- Interface class to instantiate an instance for.params
- Parameters passed to the constructor of the created instance.public IAtom newAtom()
newInstance(IAtom.class)
and should be used for
high throughput applications (e.g. IO).newAtom
in interface IChemObjectBuilder
public IBond newBond()
newInstance(IAtom.class)
and should be used for
high throughput applications (e.g. IO).newBond
in interface IChemObjectBuilder
public IAtomContainer newAtomContainer()
newInstance(IAtom.class)
and should be used for
high throughput applications (e.g. IO).newAtomContainer
in interface IChemObjectBuilder
Copyright © 2021. All rights reserved.