@Test public void testGetAtomByID() { Atom atom1 = new Atom(10, ChemEl.C, frag); frag.addAtom(atom1); Atom atom2 = new Atom(20, ChemEl.C, frag); frag.addAtom(atom2); assertEquals("ID 10 gets atom1", atom1, frag.getAtomByID(10)); assertEquals("ID 20 gets atom2", atom2, frag.getAtomByID(20)); assertNull("ID 42 is not present", frag.getAtomByID(42)); }
Atom getAtomByID(int id) { return atomMapFromId.get(id); }
Fragment implements Iterable<Atom> { Atom getAtomByID(int id) { return atomMapFromId.get(id); } }
Fragment implements Iterable<Atom> { Atom getAtomByID(int id) { return atomMapFromId.get(id); } Fragment(Element tokenEl);   Fragment(String type); }
Fragment implements Iterable<Atom> { Atom getAtomByID(int id) { return atomMapFromId.get(id); } Fragment(Element tokenEl);   Fragment(String type); @Override Iterator<Atom> iterator(); }
Fragment implements Iterable<Atom> { Atom getAtomByID(int id) { return atomMapFromId.get(id); } Fragment(Element tokenEl);   Fragment(String type); @Override Iterator<Atom> iterator();  }