@Test public void bracketAtom() { Atom input = new AtomImpl.BracketAtom(Element.Carbon, 1, 0); Atom output = FromSubsetAtoms.fromSubset(input, 0, 0); Assert.assertThat(input, CoreMatchers.is(CoreMatchers .sameInstance(output))); }
static Atom fromSubset(Atom a, int sum, int deg) { if (!a.subset()) return a; Element e = a.element(); if (a.aromatic() && deg <= sum) sum++; int hCount = a.aromatic() ? Element.implicitAromHydrogenCount(e, sum) : Element.implicitHydrogenCount(e, sum); return new AtomImpl.BracketAtom(-1, a.element(), hCount, 0, 0, a.aromatic()); }
FromSubsetAtoms extends AbstractFunction<Graph, Graph> { static Atom fromSubset(Atom a, int sum, int deg) { if (!a.subset()) return a; Element e = a.element(); if (a.aromatic() && deg <= sum) sum++; int hCount = a.aromatic() ? Element.implicitAromHydrogenCount(e, sum) : Element.implicitHydrogenCount(e, sum); return new AtomImpl.BracketAtom(-1, a.element(), hCount, 0, 0, a.aromatic()); } }
FromSubsetAtoms extends AbstractFunction<Graph, Graph> { static Atom fromSubset(Atom a, int sum, int deg) { if (!a.subset()) return a; Element e = a.element(); if (a.aromatic() && deg <= sum) sum++; int hCount = a.aromatic() ? Element.implicitAromHydrogenCount(e, sum) : Element.implicitHydrogenCount(e, sum); return new AtomImpl.BracketAtom(-1, a.element(), hCount, 0, 0, a.aromatic()); }  }
FromSubsetAtoms extends AbstractFunction<Graph, Graph> { static Atom fromSubset(Atom a, int sum, int deg) { if (!a.subset()) return a; Element e = a.element(); if (a.aromatic() && deg <= sum) sum++; int hCount = a.aromatic() ? Element.implicitAromHydrogenCount(e, sum) : Element.implicitHydrogenCount(e, sum); return new AtomImpl.BracketAtom(-1, a.element(), hCount, 0, 0, a.aromatic()); }  Graph apply(Graph g); }
FromSubsetAtoms extends AbstractFunction<Graph, Graph> { static Atom fromSubset(Atom a, int sum, int deg) { if (!a.subset()) return a; Element e = a.element(); if (a.aromatic() && deg <= sum) sum++; int hCount = a.aromatic() ? Element.implicitAromHydrogenCount(e, sum) : Element.implicitHydrogenCount(e, sum); return new AtomImpl.BracketAtom(-1, a.element(), hCount, 0, 0, a.aromatic()); }  Graph apply(Graph g);  }