@Test public void testGetAtomByLocant() { Atom atom1 = new Atom(10, ChemEl.C, frag); atom1.addLocant("a"); frag.addAtom(atom1); Atom atom2 = new Atom(20, ChemEl.C, frag); atom2.addLocant("silly"); frag.addAtom(atom2); assertEquals("Locant a gets atom1", atom1, frag.getAtomByLocant("a")); assertEquals("Locant silly gets atom2", atom2, frag.getAtomByLocant("silly")); assertNull("Locant 42 is not present", frag.getAtomByLocant("42")); }
Atom getAtomByLocant(String locant) { Atom a =atomMapFromLocant.get(locant); if (a != null){ return a; } Matcher m =MATCH_AMINOACID_STYLE_LOCANT.matcher(locant); if (m.matches()){ Atom backboneAtom =atomMapFromLocant.get(m.group(3)); if (backboneAtom==null){ return null; } a = FragmentTools.getAtomByAminoAcidStyleLocant(backboneAtom, m.group(1), m.group(2)); if (a != null){ return a; } } return null; }
Fragment implements Iterable<Atom> { Atom getAtomByLocant(String locant) { Atom a =atomMapFromLocant.get(locant); if (a != null){ return a; } Matcher m =MATCH_AMINOACID_STYLE_LOCANT.matcher(locant); if (m.matches()){ Atom backboneAtom =atomMapFromLocant.get(m.group(3)); if (backboneAtom==null){ return null; } a = FragmentTools.getAtomByAminoAcidStyleLocant(backboneAtom, m.group(1), m.group(2)); if (a != null){ return a; } } return null; } }
Fragment implements Iterable<Atom> { Atom getAtomByLocant(String locant) { Atom a =atomMapFromLocant.get(locant); if (a != null){ return a; } Matcher m =MATCH_AMINOACID_STYLE_LOCANT.matcher(locant); if (m.matches()){ Atom backboneAtom =atomMapFromLocant.get(m.group(3)); if (backboneAtom==null){ return null; } a = FragmentTools.getAtomByAminoAcidStyleLocant(backboneAtom, m.group(1), m.group(2)); if (a != null){ return a; } } return null; } Fragment(Element tokenEl);   Fragment(String type); }
Fragment implements Iterable<Atom> { Atom getAtomByLocant(String locant) { Atom a =atomMapFromLocant.get(locant); if (a != null){ return a; } Matcher m =MATCH_AMINOACID_STYLE_LOCANT.matcher(locant); if (m.matches()){ Atom backboneAtom =atomMapFromLocant.get(m.group(3)); if (backboneAtom==null){ return null; } a = FragmentTools.getAtomByAminoAcidStyleLocant(backboneAtom, m.group(1), m.group(2)); if (a != null){ return a; } } return null; } Fragment(Element tokenEl);   Fragment(String type); @Override Iterator<Atom> iterator(); }
Fragment implements Iterable<Atom> { Atom getAtomByLocant(String locant) { Atom a =atomMapFromLocant.get(locant); if (a != null){ return a; } Matcher m =MATCH_AMINOACID_STYLE_LOCANT.matcher(locant); if (m.matches()){ Atom backboneAtom =atomMapFromLocant.get(m.group(3)); if (backboneAtom==null){ return null; } a = FragmentTools.getAtomByAminoAcidStyleLocant(backboneAtom, m.group(1), m.group(2)); if (a != null){ return a; } } return null; } Fragment(Element tokenEl);   Fragment(String type); @Override Iterator<Atom> iterator();  }