@Test public void phosphoLocantedSubstitution() throws StructureBuildingException { BuildState state = new BuildState(mock(NameToStructureConfig.class)); Element word = new GroupingEl(WORD_EL); Element phospho = new TokenEl(GROUP_EL); phospho.addAttribute(new Attribute(SUBTYPE_ATR, PHOSPHO_SUBTYPE_VAL)); Fragment phosphoFrag = state.fragManager.buildSMILES("-P(=O)O"); phospho.setFrag(phosphoFrag); Element substituent = new GroupingEl(SUBSTITUENT_EL); substituent.addAttribute(new Attribute(LOCANT_ATR, "4")); substituent.addChild(phospho); Element methanol = new TokenEl(GROUP_EL); methanol.setFrag(state.fragManager.buildSMILES("CCCCO",methanol,"1/2/3/4/")); Element root = new GroupingEl(ROOT_EL); root.addChild(methanol); word.addChild(substituent); word.addChild(root); StructureBuildingMethods.resolveRootOrSubstituentLocanted(state, substituent); Set<Bond> interFragmentBonds = state.fragManager.getInterFragmentBonds(phosphoFrag); assertEquals(1, interFragmentBonds.size()); assertEquals(ChemEl.O, interFragmentBonds.iterator().next().getOtherAtom(phosphoFrag.getFirstAtom()).getElement()); }
static void resolveRootOrSubstituentLocanted(BuildState state, Element subOrRoot) throws StructureBuildingException { resolveLocantedFeatures(state, subOrRoot); boolean foundSomethingToSubstitute = potentiallyCanSubstitute(subOrRoot); if (foundSomethingToSubstitute){ performAdditiveOperations(state, subOrRoot); performLocantedSubstitutiveOperations(state, subOrRoot); } }
StructureBuildingMethods { static void resolveRootOrSubstituentLocanted(BuildState state, Element subOrRoot) throws StructureBuildingException { resolveLocantedFeatures(state, subOrRoot); boolean foundSomethingToSubstitute = potentiallyCanSubstitute(subOrRoot); if (foundSomethingToSubstitute){ performAdditiveOperations(state, subOrRoot); performLocantedSubstitutiveOperations(state, subOrRoot); } } }
StructureBuildingMethods { static void resolveRootOrSubstituentLocanted(BuildState state, Element subOrRoot) throws StructureBuildingException { resolveLocantedFeatures(state, subOrRoot); boolean foundSomethingToSubstitute = potentiallyCanSubstitute(subOrRoot); if (foundSomethingToSubstitute){ performAdditiveOperations(state, subOrRoot); performLocantedSubstitutiveOperations(state, subOrRoot); } } private  StructureBuildingMethods(); }
StructureBuildingMethods { static void resolveRootOrSubstituentLocanted(BuildState state, Element subOrRoot) throws StructureBuildingException { resolveLocantedFeatures(state, subOrRoot); boolean foundSomethingToSubstitute = potentiallyCanSubstitute(subOrRoot); if (foundSomethingToSubstitute){ performAdditiveOperations(state, subOrRoot); performLocantedSubstitutiveOperations(state, subOrRoot); } } private  StructureBuildingMethods();  }
StructureBuildingMethods { static void resolveRootOrSubstituentLocanted(BuildState state, Element subOrRoot) throws StructureBuildingException { resolveLocantedFeatures(state, subOrRoot); boolean foundSomethingToSubstitute = potentiallyCanSubstitute(subOrRoot); if (foundSomethingToSubstitute){ performAdditiveOperations(state, subOrRoot); performLocantedSubstitutiveOperations(state, subOrRoot); } } private  StructureBuildingMethods();   }