/** * Initializes an empty RGroupQuery. * * @return a new empty RGroupQuery */ private IRGroupQuery newRGroupQuery(IChemObjectBuilder builder) { IRGroupQuery rgrpQuery = new RGroupQuery(DefaultChemObjectBuilder.getInstance()); rgrpQuery.setRootStructure(builder.newInstance(IAtomContainer.class)); rgrpQuery .setRootAttachmentPoints(new HashMap<IAtom, Map<Integer, IBond>>()); rgrpQuery.setRGroupDefinitions(new HashMap<Integer, RGroupList>()); return rgrpQuery; }
/** * See restores what was saved by makeHash(). */ public void restoreFromHash(Map<Integer,Map<Integer,Integer>> mash, IAtomContainerSet mset) { if(rGroupQuery!=null) { int rootHash = mash.get(-1).get(0); rGroupQuery.setRootStructure(findContainer(rootHash,mset)); Map<Integer,RGroupList> def = rGroupQuery.getRGroupDefinitions(); for (Iterator<Integer>rgpHashItr=mash.keySet().iterator(); rgpHashItr.hasNext();) { int rgpHash = rgpHashItr.next(); restore: for(Iterator<Integer> itr= def.keySet().iterator();itr.hasNext();) { int rgrpNum=itr.next(); List<RGroup> rgpList = def.get(rgrpNum).getRGroups(); for(RGroup rgp : rgpList) { if (rgp!=null && rgp.hashCode()==rgpHash) { rgp.setGroup(findContainer(mash.get(rgpHash).get(0),mset)); if (rgp.getGroup()!=null) { rgp.setFirstAttachmentPoint(findAtom(mash.get(rgpHash).get(1),rgp.getGroup())); rgp.setSecondAttachmentPoint(findAtom(mash.get(rgpHash).get(2),rgp.getGroup())); } break restore; } } } } } }
rgrpQ.setRootStructure(redoRootStructure); rgrpQ.getRootStructure().setProperty(CDKConstants.TITLE,RGroup.ROOT_LABEL); rgrpQ.setRootAttachmentPoints(redoRootAttachmentPoints);
rgrpQ.setRootStructure(null); rgrpQ.setRootAttachmentPoints(null); for (IAtomContainer atc: hub.getIChemModel().getMoleculeSet().atomContainers()) { rgrpQ.setRootStructure(existingRoot); rgrpQ.setRootAttachmentPoints(existingRootAttachmentPoints);
rGroupQuery.setRootStructure(newAtc); newAtc.setProperty(CDKConstants.TITLE, RGroup.ROOT_LABEL); hasRoot=true;
rgrpQuery.setRootStructure(molecule);