Class DefaultChemObjectBuilder

  • All Implemented Interfaces:
    IChemObjectBuilder

    public class DefaultChemObjectBuilder
    extends Object
    implements IChemObjectBuilder
    A factory class to provide implementation independent ICDKObjects.
    
         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));
     
    Author:
    egonw, john may
    Source code:
    main
    Belongs to CDK module:
    data
    • Constructor Detail

      • DefaultChemObjectBuilder

        public DefaultChemObjectBuilder()
    • Method Detail

      • getInstance

        public static IChemObjectBuilder getInstance()
        Access the singleton instance of this DefaultChemObjectBuilder.
        
        
         // 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");
         
        Returns:
        a DefaultChemObjectBuilder instance
      • newAtom

        public IAtom newAtom()
        Create a new atom using the default constructor. This method is considerably faster than the dynamic dispatch of newInstance(IAtom.class) and should be used for high throughput applications (e.g. IO).
        Specified by:
        newAtom in interface IChemObjectBuilder
        Returns:
        new atom
      • newBond

        public IBond newBond()
        Create a new bond using the default constructor. This method is considerably faster than the dynamic dispatch of newInstance(IBond.class) and should be used for high throughput applications (e.g. IO).
        Specified by:
        newBond in interface IChemObjectBuilder
        Returns:
        new bond
      • newAtomContainer

        public IAtomContainer newAtomContainer()
        Create a new atom container using the default constructor. This method is considerably faster than the dynamic dispatch of newInstance(IAtomContainer.class) and should be used for high throughput applications (e.g. IO).
        Specified by:
        newAtomContainer in interface IChemObjectBuilder
        Returns:
        the new atom container
      • newReaction

        public IReaction newReaction()
        Create a new reaction using the default constructor. This method is considerably faster than the dynamic dispatch of newInstance(IReaction.class) and should be used for high throughput applications (e.g. IO).
        Specified by:
        newReaction in interface IChemObjectBuilder
        Returns:
        the new reaction