@Override public IChemObject newTestObject() { return new PseudoAtom(); } });
@Override public IFragmentAtom clone() throws CloneNotSupportedException { IFragmentAtom cpy = (IFragmentAtom) super.clone(); cpy.setFragment(fragment.clone()); cpy.setExpanded(isExpanded); return cpy; } }
/** * Returns a one line string representation of this Atom. * Methods is conform RFC #9. * * @return The string representation of this Atom */ @Override public String toString() { StringBuffer description = new StringBuffer(); description.append("PseudoAtom("); description.append(this.hashCode()); if (getLabel() != null) { description.append(", ").append(getLabel()); } description.append(", ").append(super.toString()); description.append(')'); return description.toString(); }
@Override public String toString() { StringBuffer buffer = new StringBuffer(50); buffer.append("FragmentAtom{").append(hashCode()); buffer.append(", A=").append(super.toString()); if (fragment != null) { buffer.append(", F=").append(fragment.toString()); } buffer.append('}'); return buffer.toString(); }
/** * Constructs an PseudoAtom from a IAtom. * * @param element IAtom from which the PseudoAtom is constructed */ public PseudoAtom(IElement element) { super(element); setAtomicNumber(0); if (element instanceof IPseudoAtom) { this.label = ((IPseudoAtom) element).getLabel(); } else { this.label = "R"; } }
@Override public String toString() { StringBuffer buffer = new StringBuffer(50); buffer.append("FragmentAtom{").append(hashCode()); buffer.append(", A=").append(super.toString()); if (fragment != null) { buffer.append(", F=").append(fragment.toString()); } buffer.append('}'); return buffer.toString(); }
/** * Constructs an PseudoAtom from a IAtom. * * @param element IAtom from which the PseudoAtom is constructed */ public PseudoAtom(IElement element) { super(element); setAtomicNumber(0); if (element instanceof IPseudoAtom) { this.label = ((IPseudoAtom) element).getLabel(); } else { this.label = "R"; } }
@BeforeClass public static void setUp() { setTestObjectBuilder(new ITestObjectBuilder() { @Override public IChemObject newTestObject() { return new PseudoAtom(); } }); }
/** * Returns a one line string representation of this Atom. * Methods is conform RFC #9. * * @return The string representation of this Atom */ @Override public String toString() { StringBuffer description = new StringBuffer(); description.append("PseudoAtom("); description.append(this.hashCode()); if (getLabel() != null) { description.append(", ").append(getLabel()); } description.append(", ").append(super.toString()); description.append(')'); return description.toString(); }
@Override public IFragmentAtom clone() throws CloneNotSupportedException { IFragmentAtom cpy = (IFragmentAtom) super.clone(); cpy.setFragment(fragment.clone()); cpy.setExpanded(isExpanded); return cpy; } }
@Test public void pseudoAtom_nullH() throws Exception { assertThat(new CDKToBeam().toBeamAtom(new PseudoAtom("R")).hydrogens(), is(0)); assertThat(new CDKToBeam().toBeamAtom(new PseudoAtom("*")).hydrogens(), is(0)); assertThat(new CDKToBeam().toBeamAtom(new PseudoAtom("R1")).hydrogens(), is(0)); }
@Test public void unknownSymbol() throws Exception { IAtom a = new PseudoAtom("ALA"); a.setImplicitHydrogenCount(0); assertThat(new CDKToBeam().toBeamAtom(a).element(), is(Element.Unknown)); }
@Test public void unknownSymbol_Pseudo() throws Exception { IAtom a = new PseudoAtom("R1"); a.setImplicitHydrogenCount(0); assertThat(new CDKToBeam().toBeamAtom(a).element(), is(Element.Unknown)); }
@Test public void testPseudoAtom() { IPseudoAtom a = new PseudoAtom(); Assert.assertEquals("R", a.getSymbol()); Assert.assertNull(a.getPoint3d()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test public void testPseudoAtom_String() { String label = "Arg255"; IPseudoAtom a = new PseudoAtom(label); Assert.assertEquals("R", a.getSymbol()); Assert.assertEquals(label, a.getLabel()); Assert.assertNull(a.getPoint3d()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test public void testPseudoAtom_IElement() { IElement element = newChemObject().getBuilder().newInstance(IElement.class); IPseudoAtom a = new PseudoAtom(element); Assert.assertEquals("R", a.getSymbol()); Assert.assertNull(a.getPoint3d()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test @Override public void testPseudoAtom_IAtom() { IAtom element = newChemObject().getBuilder().newInstance(IAtom.class, "C"); IPseudoAtom a = new PseudoAtom(element); Assert.assertEquals("R", a.getSymbol()); Assert.assertNull(a.getPoint3d()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test public void testPseudoAtom_String_Point2d() { Point2d point = new Point2d(1.0, 2.0); String label = "Arg255"; IPseudoAtom a = new PseudoAtom(label, point); Assert.assertEquals("R", a.getSymbol()); Assert.assertEquals(label, a.getLabel()); Assert.assertEquals(point, a.getPoint2d()); Assert.assertNull(a.getPoint3d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test public void testPseudoAtom_String_Point3d() { Point3d point = new Point3d(1.0, 2.0, 3.0); String label = "Arg255"; IPseudoAtom a = new PseudoAtom(label, point); Assert.assertEquals("R", a.getSymbol()); Assert.assertEquals(label, a.getLabel()); Assert.assertEquals(point, a.getPoint3d()); Assert.assertNull(a.getPoint2d()); Assert.assertNull(a.getFractionalPoint3d()); }
@Test public void generateLabelledSmiles() throws CDKException { IAtomContainer mol = new AtomContainer(); mol.addAtom(new Atom("C")); mol.getAtom(0).setImplicitHydrogenCount(3); mol.addAtom(new Atom("C")); mol.getAtom(1).setImplicitHydrogenCount(2); mol.addAtom(new PseudoAtom("R1")); mol.getAtom(2).setImplicitHydrogenCount(0); mol.addBond(0, 1, IBond.Order.SINGLE); mol.addBond(1, 2, IBond.Order.SINGLE); SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxAtomLabel); String smi = smigen.create(mol); assertThat(smi, is("CC* |$;;R1$|")); }