@Test public void testLabelHydrazinecarbohydrazide() throws StructureBuildingException { frag = fm.buildSMILES("NN", SIMPLEGROUP_TYPE_VAL, "1/2"); Fragment suffix = fm.buildSMILES("[R]C(=O)NN", SUFFIX_TYPE_VAL, "/X List<Fragment> suffixes = new ArrayList<Fragment>(); suffixes.add(suffix); FragmentTools.assignElementLocants(frag, suffixes); fm.incorporateFragment(suffix, frag); assertEquals("Can find locant N in frag: ID = 6", 6, frag.getIDFromLocant("N")); assertEquals("Can find locant N' in frag: ID = 7", 7, frag.getIDFromLocant("N'")); assertEquals("Can't find locant N'' in frag", 0, frag.getIDFromLocant("N''")); assertEquals("Can't find locant C in frag", 0, frag.getIDFromLocant("C")); }
int getIDFromLocant(String locant) { Atom a = getAtomByLocant(locant); if (a != null){ return a.getID(); } return 0; }
Fragment implements Iterable<Atom> { int getIDFromLocant(String locant) { Atom a = getAtomByLocant(locant); if (a != null){ return a.getID(); } return 0; } }
Fragment implements Iterable<Atom> { int getIDFromLocant(String locant) { Atom a = getAtomByLocant(locant); if (a != null){ return a.getID(); } return 0; } Fragment(Element tokenEl);   Fragment(String type); }
Fragment implements Iterable<Atom> { int getIDFromLocant(String locant) { Atom a = getAtomByLocant(locant); if (a != null){ return a.getID(); } return 0; } Fragment(Element tokenEl);   Fragment(String type); @Override Iterator<Atom> iterator(); }
Fragment implements Iterable<Atom> { int getIDFromLocant(String locant) { Atom a = getAtomByLocant(locant); if (a != null){ return a.getID(); } return 0; } Fragment(Element tokenEl);   Fragment(String type); @Override Iterator<Atom> iterator();  }