/** * Access the singleton instance of this DefaultChemObjectBuilder. * <pre>{@code * * // 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"); * }</pre> * * @return a DefaultChemObjectBuilder instance */ public static IChemObjectBuilder getInstance() { IChemObjectBuilder result = instance; if (result == null) { result = instance; synchronized (LOCK) { if (result == null) { instance = result = new DefaultChemObjectBuilder(); } } } return result; }
/** * Access the singleton instance of this DefaultChemObjectBuilder. * <pre>{@code * * // 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"); * }</pre> * * @return a DefaultChemObjectBuilder instance */ public static IChemObjectBuilder getInstance() { IChemObjectBuilder result = instance; if (result == null) { result = instance; synchronized (LOCK) { if (result == null) { instance = result = new DefaultChemObjectBuilder(); } } } return result; }