/** * Create a template from a substructure pattern. Using this template handler in the diagram * generator then allows us to align to common reference. * * @param ptrn the structure pattern to match * @param mol molecule * @return new template handler */ public static TemplateHandler createFromSubstructure(Pattern ptrn, IAtomContainer mol) { for (IAtomContainer template : ptrn.matchAll(mol).toSubstructures()) return createSingleton(template); throw new IllegalArgumentException("Pattern does not match any provided molecules"); }
/** * Create a template from a substructure pattern. Using this template handler in the diagram * generator then allows us to align to common reference. * * @param ptrn the structure pattern to match * @param mol molecule * @return new template handler */ public static TemplateHandler createFromSubstructure(Pattern ptrn, IAtomContainer mol) { for (IAtomContainer template : ptrn.matchAll(mol).toSubstructures()) return createSingleton(template); throw new IllegalArgumentException("Pattern does not match any provided molecules"); }
/** * Create a template from a substructure pattern. Using this template handler in the diagram * generator then allows us to align to common reference. * * @param ptrn the structure pattern to match * @param mols list of molecules * @return new template handler */ public static TemplateHandler createFromSubstructure(Pattern ptrn, Iterable<IAtomContainer> mols) { for (IAtomContainer mol : mols) { for (IAtomContainer template : ptrn.matchAll(mol).toSubstructures()) return createSingleton(template); } throw new IllegalArgumentException("Pattern does not match any provided molecules"); }
/** * Create a template from a substructure pattern. Using this template handler in the diagram * generator then allows us to align to common reference. * * @param ptrn the structure pattern to match * @param mols list of molecules * @return new template handler */ public static TemplateHandler createFromSubstructure(Pattern ptrn, Iterable<IAtomContainer> mols) { for (IAtomContainer mol : mols) { for (IAtomContainer template : ptrn.matchAll(mol).toSubstructures()) return createSingleton(template); } throw new IllegalArgumentException("Pattern does not match any provided molecules"); }